# `vllm_mlx.mcp.executor`

Tool executor for handling tool calls from model responses.

[View the complete module source at #L1-L500](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L1-L500).

## API details

Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.

::: vllm_mlx.mcp.executor
    options:
      members:
        - logger
        - ToolArgumentValidationError
        - validate_tool_arguments
        - ToolExecutor
        - execute_single_tool
      filters: []
      show_if_no_docstring: true

## Complete contract reference

Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolArgumentValidationError" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolArgumentValidationError</code> · class</summary>

```python
vllm_mlx.mcp.executor.ToolArgumentValidationError()
```

Raised when tool arguments fail validation against schema.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Constructs: `vllm_mlx.mcp.executor.ToolArgumentValidationError`

**Exceptions and behavior**

Class `ToolArgumentValidationError` derives from `Exception` and declares 0 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L22-L25](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L22-L25).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.validate_tool_arguments" markdown="1">
<summary><code>vllm_mlx.mcp.executor.validate_tool_arguments</code> · function</summary>

```python
vllm_mlx.mcp.executor.validate_tool_arguments(tool: MCPTool, arguments: Dict[str, Any], strict: bool = True) -> None
```

Validate tool arguments against the tool's input schema.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tool` | `MCPTool` | `yes` | `none` | The MCP tool with input_schema |
| `arguments` | `Dict[str, Any]` | `yes` | `none` | Arguments to validate |
| `strict` | `bool` | `no` | `True` | If True, raise exception on validation failure |

**Returns**

- Type: `None`
- Direct return expressions: `None`

**Exceptions and behavior**

Function `validate_tool_arguments` calls `logger.debug`, `jsonschema.validate`, `'.'.join`, `str`; can raise `ToolArgumentValidationError`; returns `None`.
Directly raised exceptions: `ToolArgumentValidationError`.

[View source #L28-L61](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L28-L61).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor</code> · class</summary>

```python
vllm_mlx.mcp.executor.ToolExecutor(manager: MCPClientManager, max_parallel: int = 5, default_timeout: Optional[float] = None, validate_arguments: bool = True, sandbox: Optional[ToolSandbox] = None)
```

Handles execution of tool calls from model responses.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `manager` | `MCPClientManager` | `yes` | `none` | MCP client manager |
| `max_parallel` | `int` | `no` | `5` | Maximum parallel tool executions |
| `default_timeout` | `Optional[float]` | `no` | `None` | Default timeout for tool calls |
| `validate_arguments` | `bool` | `no` | `True` | If True, validate arguments against tool schemas |
| `sandbox` | `Optional[ToolSandbox]` | `no` | `None` | Optional tool sandbox for security controls. Uses global if None. |

**Returns**

- Constructs: `vllm_mlx.mcp.executor.ToolExecutor`

**Exceptions and behavior**

Class `ToolExecutor` declares 11 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L64-L479](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L64-L479).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor.__init__" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor.__init__</code> · method</summary>

```python
vllm_mlx.mcp.executor.ToolExecutor.__init__(manager: MCPClientManager, max_parallel: int = 5, default_timeout: Optional[float] = None, validate_arguments: bool = True, sandbox: Optional[ToolSandbox] = None) -> not annotated
```

Initialize tool executor.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `manager` | `MCPClientManager` | `yes` | `none` | MCP client manager |
| `max_parallel` | `int` | `no` | `5` | Maximum parallel tool executions |
| `default_timeout` | `Optional[float]` | `no` | `None` | Default timeout for tool calls |
| `validate_arguments` | `bool` | `no` | `True` | If True, validate arguments against tool schemas |
| `sandbox` | `Optional[ToolSandbox]` | `no` | `None` | Optional tool sandbox for security controls. Uses global if None. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `ToolExecutor.__init__` updates `self.manager`, `self.max_parallel`, `self.default_timeout`, `self.validate_arguments`; calls `get_sandbox`.
No direct `raise` statement appears in this definition.

[View source #L75-L97](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L75-L97).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor.execute_tool_calls" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor.execute_tool_calls</code> · method</summary>

```python
async vllm_mlx.mcp.executor.ToolExecutor.execute_tool_calls(tool_calls: List[Dict[str, Any]], parallel: bool = True) -> List[Tuple[MCPToolResult, str]]
```

Execute multiple tool calls.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tool_calls` | `List[Dict[str, Any]]` | `yes` | `none` | List of OpenAI tool call objects |
| `parallel` | `bool` | `no` | `True` | Execute in parallel (True) or sequential (False) |

**Returns**

- Type: `List[Tuple[MCPToolResult, str]]`
- Direct return expressions: `[]`; `await self._execute_parallel(tool_calls)`; `await self._execute_sequential(tool_calls)`

**Exceptions and behavior**

Method `ToolExecutor.execute_tool_calls` calls `self._execute_parallel`, `self._execute_sequential`; awaits asynchronous work; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L99-L120](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L99-L120).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor._get_tool_by_name" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor._get_tool_by_name</code> · method</summary>

```python
vllm_mlx.mcp.executor.ToolExecutor._get_tool_by_name(full_name: str) -> Optional[MCPTool]
```

Get a tool by its full name (server__tool or just tool).

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `full_name` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `Optional[MCPTool]`
- Direct return expressions: `tool`; `None`

**Exceptions and behavior**

Method `ToolExecutor._get_tool_by_name` calls `self.manager.get_all_tools`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L122-L132](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L122-L132).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor._validate_tool_call" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor._validate_tool_call</code> · method</summary>

```python
vllm_mlx.mcp.executor.ToolExecutor._validate_tool_call(tool_call: Dict[str, Any]) -> Optional[str]
```

Validate a tool call's arguments against the tool's schema.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tool_call` | `Dict[str, Any]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `Optional[str]`
- Direct return expressions: `None`; `f"Invalid JSON in arguments for tool '{name}'"`; `str(e)`

**Exceptions and behavior**

Method `ToolExecutor._validate_tool_call` calls `tool_call.get`, `func.get`, `isinstance`, `json.loads`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L134-L165](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L134-L165).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor._validate_sandbox" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor._validate_sandbox</code> · method</summary>

```python
vllm_mlx.mcp.executor.ToolExecutor._validate_sandbox(tool_name: str, server_name: str, arguments: Dict[str, Any]) -> Optional[str]
```

Validate tool execution against sandbox policy.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tool_name` | `str` | `yes` | `none` | Required positional or keyword input. |
| `server_name` | `str` | `yes` | `none` | Required positional or keyword input. |
| `arguments` | `Dict[str, Any]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `Optional[str]`
- Direct return expressions: `None`; `str(e)`

**Exceptions and behavior**

Method `ToolExecutor._validate_sandbox` calls `self.sandbox.validate_tool_execution`, `str`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L167-L183](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L167-L183).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor._get_server_for_tool" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor._get_server_for_tool</code> · method</summary>

```python
vllm_mlx.mcp.executor.ToolExecutor._get_server_for_tool(full_name: str) -> str
```

Extract server name from full tool name or find it.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `full_name` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `str`
- Direct return expressions: `full_name.split('__')[0]`; `tool.server_name`; `'unknown'`

**Exceptions and behavior**

Method `ToolExecutor._get_server_for_tool` calls `full_name.split`, `self.manager.get_all_tools`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L185-L193](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L185-L193).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor._execute_parallel" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor._execute_parallel</code> · method</summary>

```python
async vllm_mlx.mcp.executor.ToolExecutor._execute_parallel(tool_calls: List[Dict[str, Any]]) -> List[Tuple[MCPToolResult, str]]
```

Execute tool calls in parallel with concurrency limit.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tool_calls` | `List[Dict[str, Any]]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `List[Tuple[MCPToolResult, str]]`
- Direct return expressions: `processed`

**Exceptions and behavior**

Method `ToolExecutor._execute_parallel` calls `asyncio.Semaphore`, `execute_with_semaphore`, `asyncio.gather`, `enumerate`; awaits asynchronous work; returns `processed`.
No direct `raise` statement appears in this definition.

[View source #L195-L305](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L195-L305).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor._execute_parallel.execute_with_semaphore" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor._execute_parallel.execute_with_semaphore</code> · nested function</summary>

```python
async vllm_mlx.mcp.executor.ToolExecutor._execute_parallel.execute_with_semaphore(tool_call: Dict[str, Any]) -> not annotated
```

Nested Function `ToolExecutor._execute_parallel.execute_with_semaphore` calls `tool_call.get`, `func.get`, `isinstance`, `json.loads`; awaits asynchronous work; has 3 explicit return paths.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tool_call` | `Dict[str, Any]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`
- Direct return expressions: `(MCPToolResult(tool_name=name, content=None, is_error=True, error_message=validation_error), call_id)`; `(MCPToolResult(tool_name=name, content=None, is_error=True, error_message=sandbox_error), call_id)`; `(result, call_id)`

**Exceptions and behavior**

Nested Function `ToolExecutor._execute_parallel.execute_with_semaphore` calls `tool_call.get`, `func.get`, `isinstance`, `json.loads`; awaits asynchronous work; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L202-L281](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L202-L281).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor._execute_sequential" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor._execute_sequential</code> · method</summary>

```python
async vllm_mlx.mcp.executor.ToolExecutor._execute_sequential(tool_calls: List[Dict[str, Any]]) -> List[Tuple[MCPToolResult, str]]
```

Execute tool calls sequentially.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tool_calls` | `List[Dict[str, Any]]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `List[Tuple[MCPToolResult, str]]`
- Direct return expressions: `results`

**Exceptions and behavior**

Method `ToolExecutor._execute_sequential` calls `tool_call.get`, `func.get`, `isinstance`, `json.loads`; awaits asynchronous work; returns `results`.
No direct `raise` statement appears in this definition.

[View source #L307-L415](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L307-L415).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor.execute_and_format" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor.execute_and_format</code> · method</summary>

```python
async vllm_mlx.mcp.executor.ToolExecutor.execute_and_format(tool_calls: List[Dict[str, Any]], parallel: bool = True) -> List[Dict[str, Any]]
```

Execute tool calls and format results as messages.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tool_calls` | `List[Dict[str, Any]]` | `yes` | `none` | List of OpenAI tool call objects |
| `parallel` | `bool` | `no` | `True` | Execute in parallel |

**Returns**

- Type: `List[Dict[str, Any]]`
- Direct return expressions: `[format_tool_result(result, call_id) for result, call_id in results]`

**Exceptions and behavior**

Method `ToolExecutor.execute_and_format` calls `self.execute_tool_calls`, `format_tool_result`; awaits asynchronous work; returns `[format_tool_result(result, call_id) for result, call_id in results]`.
No direct `raise` statement appears in this definition.

[View source #L417-L433](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L417-L433).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor.extract_and_validate" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor.extract_and_validate</code> · method</summary>

```python
vllm_mlx.mcp.executor.ToolExecutor.extract_and_validate(response: Dict[str, Any]) -> Tuple[List[Dict[str, Any]], bool]
```

Extract tool calls from response and validate them.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `response` | `Dict[str, Any]` | `yes` | `none` | Model response in OpenAI format |

**Returns**

- Type: `Tuple[List[Dict[str, Any]], bool]`
- Direct return expressions: `([], True)`; `(tool_calls, all_valid)`

**Exceptions and behavior**

Method `ToolExecutor.extract_and_validate` calls `extract_tool_calls`, `tc.get`, `func.get`, `self._tool_exists`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L435-L464](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L435-L464).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.ToolExecutor._tool_exists" markdown="1">
<summary><code>vllm_mlx.mcp.executor.ToolExecutor._tool_exists</code> · method</summary>

```python
vllm_mlx.mcp.executor.ToolExecutor._tool_exists(full_name: str) -> bool
```

Check if a tool exists in any connected server.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `full_name` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `bool`
- Direct return expressions: `True`; `False`

**Exceptions and behavior**

Method `ToolExecutor._tool_exists` calls `self.manager.get_all_tools`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L466-L479](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L466-L479).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.executor.execute_single_tool" markdown="1">
<summary><code>vllm_mlx.mcp.executor.execute_single_tool</code> · function</summary>

```python
async vllm_mlx.mcp.executor.execute_single_tool(manager: MCPClientManager, tool_name: str, arguments: Dict[str, Any], timeout: Optional[float] = None) -> MCPToolResult
```

Convenience function to execute a single tool.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `manager` | `MCPClientManager` | `yes` | `none` | MCP client manager |
| `tool_name` | `str` | `yes` | `none` | Full tool name (server__tool) |
| `arguments` | `Dict[str, Any]` | `yes` | `none` | Tool arguments |
| `timeout` | `Optional[float]` | `no` | `None` | Optional timeout |

**Returns**

- Type: `MCPToolResult`
- Direct return expressions: `await manager.execute_tool(tool_name, arguments, timeout)`

**Exceptions and behavior**

Function `execute_single_tool` calls `manager.execute_tool`; awaits asynchronous work; returns `await manager.execute_tool(tool_name, arguments, timeout)`.
No direct `raise` statement appears in this definition.

[View source #L482-L500](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L482-L500).

</details>

## Complete symbol map

This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.

| Symbol | Kind | Signature and inputs | What it does | Source |
| --- | --- | --- | --- | --- |
| [`ToolArgumentValidationError`](#contract-vllm_mlx.mcp.executor.ToolArgumentValidationError) | class | `ToolArgumentValidationError()` | Raised when tool arguments fail validation against schema. | [#L22-L25](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L22-L25) |
| [`validate_tool_arguments`](#contract-vllm_mlx.mcp.executor.validate_tool_arguments) | function | `validate_tool_arguments(tool: MCPTool, arguments: Dict[str, Any], strict: bool = True) -> None` | Validate tool arguments against the tool's input schema. | [#L28-L61](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L28-L61) |
| [`ToolExecutor`](#contract-vllm_mlx.mcp.executor.ToolExecutor) | class | `ToolExecutor(manager: MCPClientManager, max_parallel: int = 5, default_timeout: Optional[float] = None, validate_arguments: bool = True, sandbox: Optional[ToolSandbox] = None)` | Handles execution of tool calls from model responses. | [#L64-L479](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L64-L479) |
| [`ToolExecutor.__init__`](#contract-vllm_mlx.mcp.executor.ToolExecutor.__init__) | method | `ToolExecutor.__init__(manager: MCPClientManager, max_parallel: int = 5, default_timeout: Optional[float] = None, validate_arguments: bool = True, sandbox: Optional[ToolSandbox] = None) -> not annotated` | Initialize tool executor. | [#L75-L97](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L75-L97) |
| [`ToolExecutor.execute_tool_calls`](#contract-vllm_mlx.mcp.executor.ToolExecutor.execute_tool_calls) | method | `async ToolExecutor.execute_tool_calls(tool_calls: List[Dict[str, Any]], parallel: bool = True) -> List[Tuple[MCPToolResult, str]]` | Execute multiple tool calls. | [#L99-L120](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L99-L120) |
| [`ToolExecutor._get_tool_by_name`](#contract-vllm_mlx.mcp.executor.ToolExecutor._get_tool_by_name) | method | `ToolExecutor._get_tool_by_name(full_name: str) -> Optional[MCPTool]` | Get a tool by its full name (server__tool or just tool). | [#L122-L132](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L122-L132) |
| [`ToolExecutor._validate_tool_call`](#contract-vllm_mlx.mcp.executor.ToolExecutor._validate_tool_call) | method | `ToolExecutor._validate_tool_call(tool_call: Dict[str, Any]) -> Optional[str]` | Validate a tool call's arguments against the tool's schema. | [#L134-L165](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L134-L165) |
| [`ToolExecutor._validate_sandbox`](#contract-vllm_mlx.mcp.executor.ToolExecutor._validate_sandbox) | method | `ToolExecutor._validate_sandbox(tool_name: str, server_name: str, arguments: Dict[str, Any]) -> Optional[str]` | Validate tool execution against sandbox policy. | [#L167-L183](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L167-L183) |
| [`ToolExecutor._get_server_for_tool`](#contract-vllm_mlx.mcp.executor.ToolExecutor._get_server_for_tool) | method | `ToolExecutor._get_server_for_tool(full_name: str) -> str` | Extract server name from full tool name or find it. | [#L185-L193](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L185-L193) |
| [`ToolExecutor._execute_parallel`](#contract-vllm_mlx.mcp.executor.ToolExecutor._execute_parallel) | method | `async ToolExecutor._execute_parallel(tool_calls: List[Dict[str, Any]]) -> List[Tuple[MCPToolResult, str]]` | Execute tool calls in parallel with concurrency limit. | [#L195-L305](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L195-L305) |
| [`ToolExecutor._execute_parallel.execute_with_semaphore`](#contract-vllm_mlx.mcp.executor.ToolExecutor._execute_parallel.execute_with_semaphore) | nested function | `async ToolExecutor._execute_parallel.execute_with_semaphore(tool_call: Dict[str, Any]) -> not annotated` | Nested Function `ToolExecutor._execute_parallel.execute_with_semaphore` calls `tool_call.get`, `func.get`, `isinstance`, `json.loads`; awaits asynchronous work; has 3 explicit return paths. | [#L202-L281](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L202-L281) |
| [`ToolExecutor._execute_sequential`](#contract-vllm_mlx.mcp.executor.ToolExecutor._execute_sequential) | method | `async ToolExecutor._execute_sequential(tool_calls: List[Dict[str, Any]]) -> List[Tuple[MCPToolResult, str]]` | Execute tool calls sequentially. | [#L307-L415](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L307-L415) |
| [`ToolExecutor.execute_and_format`](#contract-vllm_mlx.mcp.executor.ToolExecutor.execute_and_format) | method | `async ToolExecutor.execute_and_format(tool_calls: List[Dict[str, Any]], parallel: bool = True) -> List[Dict[str, Any]]` | Execute tool calls and format results as messages. | [#L417-L433](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L417-L433) |
| [`ToolExecutor.extract_and_validate`](#contract-vllm_mlx.mcp.executor.ToolExecutor.extract_and_validate) | method | `ToolExecutor.extract_and_validate(response: Dict[str, Any]) -> Tuple[List[Dict[str, Any]], bool]` | Extract tool calls from response and validate them. | [#L435-L464](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L435-L464) |
| [`ToolExecutor._tool_exists`](#contract-vllm_mlx.mcp.executor.ToolExecutor._tool_exists) | method | `ToolExecutor._tool_exists(full_name: str) -> bool` | Check if a tool exists in any connected server. | [#L466-L479](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L466-L479) |
| [`execute_single_tool`](#contract-vllm_mlx.mcp.executor.execute_single_tool) | function | `async execute_single_tool(manager: MCPClientManager, tool_name: str, arguments: Dict[str, Any], timeout: Optional[float] = None) -> MCPToolResult` | Convenience function to execute a single tool. | [#L482-L500](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/executor.py#L482-L500) |
