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.
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
¶
Example: MCP Tool Use with vllm-mlx
This example demonstrates how to use MCP (Model Context Protocol) tools with the vllm-mlx server.
Prerequisites:
1. Install MCP support: pip install vllm-mlx[mcp]
2. Create mcp.json config (see example below)
3. Start server with MCP: vllm-mlx serve
Example mcp.json: { "servers": { "filesystem": { "transport": "stdio", "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"] } } }
Usage
python examples/mcp_tool_use.py
examples.mcp_tool_use.main
¶
Source code in examples/mcp_tool_use.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
examples.mcp_tool_use.list_mcp_servers
¶
Helper to list MCP server status.
Source code in examples/mcp_tool_use.py
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.
examples.mcp_tool_use.main · function
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.
examples.mcp_tool_use.list_mcp_servers · function
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.
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 |
function | main() -> not annotated |
Function main calls OpenAI, print, requests.get(f'{base_url}/health').json, requests.get; returns None. |
#L35-L159 |
list_mcp_servers |
function | list_mcp_servers() -> not annotated |
Helper to list MCP server status. | #L162-L172 |