# `examples.mcp_tool_use`

Example: MCP Tool Use with vllm-mlx This example demonstrates how to use MCP (Model Context Protocol) tools with the vllm-mlx server.

[View the complete module source at #L1-L176](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mcp_tool_use.py#L1-L176).

## 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.

::: examples.mcp_tool_use
    options:
      members:
        - main
        - list_mcp_servers
      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-examples.mcp_tool_use.main" markdown="1">
<summary><code>examples.mcp_tool_use.main</code> · function</summary>

```python
examples.mcp_tool_use.main() -> not annotated
```

Function `main` calls `OpenAI`, `print`, `requests.get(f'{base_url}/health').json`, `requests.get`; returns `None`.

**Parameters**

This callable has no explicit inputs.

**Returns**

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

**Exceptions and behavior**

Function `main` calls `OpenAI`, `print`, `requests.get(f'{base_url}/health').json`, `requests.get`; returns `None`.
No direct `raise` statement appears in this definition.

[View source #L35-L159](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mcp_tool_use.py#L35-L159).

</details>

<details class="api-contract" id="contract-examples.mcp_tool_use.list_mcp_servers" markdown="1">
<summary><code>examples.mcp_tool_use.list_mcp_servers</code> · function</summary>

```python
examples.mcp_tool_use.list_mcp_servers() -> not annotated
```

Helper to list MCP server status.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Function `list_mcp_servers` calls `requests.get(f'{base_url}/mcp/servers').json`, `requests.get`, `print`, `servers.get`.
No direct `raise` statement appears in this definition.

[View source #L162-L172](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mcp_tool_use.py#L162-L172).

</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 |
| --- | --- | --- | --- | --- |
| [`main`](#contract-examples.mcp_tool_use.main) | function | `main() -> not annotated` | Function `main` calls `OpenAI`, `print`, `requests.get(f'{base_url}/health').json`, `requests.get`; returns `None`. | [#L35-L159](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mcp_tool_use.py#L35-L159) |
| [`list_mcp_servers`](#contract-examples.mcp_tool_use.list_mcp_servers) | function | `list_mcp_servers() -> not annotated` | Helper to list MCP server status. | [#L162-L172](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mcp_tool_use.py#L162-L172) |
