vllm_mlx.mcp.types¶
Type definitions for MCP client support.
View the complete module source at #L1-L179.
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.types
¶
Type definitions for MCP client support.
vllm_mlx.mcp.types.MCPTransport
¶
vllm_mlx.mcp.types.MCPServerState
¶
vllm_mlx.mcp.types.MCPServerConfig
dataclass
¶
MCPServerConfig(name: str, transport: MCPTransport = STDIO, command: Optional[str] = None, args: Optional[List[str]] = None, env: Optional[Dict[str, str]] = None, url: Optional[str] = None, enabled: bool = True, timeout: float = 30.0)
Configuration for a single MCP server.
vllm_mlx.mcp.types.MCPServerConfig.transport
class-attribute
instance-attribute
¶
transport: MCPTransport = MCPTransport.STDIO
vllm_mlx.mcp.types.MCPServerConfig.command
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPServerConfig.args
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPServerConfig.env
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPServerConfig.url
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPServerConfig.enabled
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPServerConfig.timeout
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPServerConfig.__post_init__
¶
Validate configuration.
Source code in vllm_mlx/mcp/types.py
vllm_mlx.mcp.types.MCPServerConfig._validate_security
¶
Validate security of the configuration.
Source code in vllm_mlx/mcp/types.py
vllm_mlx.mcp.types.MCPConfig
dataclass
¶
MCPConfig(servers: Dict[str, MCPServerConfig] = dict(), max_tool_calls: int = 10, default_timeout: float = 30.0, allowed_high_risk_tools: Set[str] = set())
Root configuration for MCP client.
vllm_mlx.mcp.types.MCPConfig.servers
class-attribute
instance-attribute
¶
servers: Dict[str, MCPServerConfig] = field(default_factory=dict)
vllm_mlx.mcp.types.MCPConfig.max_tool_calls
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPConfig.default_timeout
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPConfig.allowed_high_risk_tools
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPConfig.from_dict
classmethod
¶
from_dict(data: Dict[str, Any]) -> MCPConfig
Create config from dictionary.
Source code in vllm_mlx/mcp/types.py
vllm_mlx.mcp.types.MCPTool
dataclass
¶
Normalized tool representation from MCP server.
vllm_mlx.mcp.types.MCPToolResult
dataclass
¶
MCPToolResult(tool_name: str, content: Any, is_error: bool = False, error_message: Optional[str] = None)
Result from a tool execution.
vllm_mlx.mcp.types.MCPToolResult.is_error
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPToolResult.error_message
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPToolResult.to_message
¶
Convert to OpenAI tool result message format.
Source code in vllm_mlx/mcp/types.py
vllm_mlx.mcp.types.MCPServerStatus
dataclass
¶
MCPServerStatus(name: str, state: MCPServerState, transport: MCPTransport, tools_count: int = 0, error: Optional[str] = None, last_connected: Optional[float] = None)
Status of an MCP server connection.
vllm_mlx.mcp.types.MCPServerStatus.tools_count
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPServerStatus.error
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPServerStatus.last_connected
class-attribute
instance-attribute
¶
vllm_mlx.mcp.types.MCPServerStatus.to_dict
¶
Convert to dictionary for API response.
Source code in vllm_mlx/mcp/types.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.
vllm_mlx.mcp.types.MCPTransport · class
Supported MCP transport types.
Parameters
This callable has no explicit inputs.
Returns
- Constructs:
vllm_mlx.mcp.types.MCPTransport
Exceptions and behavior
Class MCPTransport derives from str, Enum and declares 0 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.mcp.types.MCPServerState · class
MCP server connection states.
Parameters
This callable has no explicit inputs.
Returns
- Constructs:
vllm_mlx.mcp.types.MCPServerState
Exceptions and behavior
Class MCPServerState derives from str, Enum and declares 0 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.mcp.types.MCPServerConfig · class
vllm_mlx.mcp.types.MCPServerConfig(name: str, transport: MCPTransport = MCPTransport.STDIO, command: Optional[str] = None, args: Optional[List[str]] = None, env: Optional[Dict[str, str]] = None, url: Optional[str] = None, enabled: bool = True, timeout: float = 30.0)
Configuration for a single MCP server.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name |
str |
yes |
none |
Required constructor field. |
transport |
MCPTransport |
no |
MCPTransport.STDIO |
Optional constructor field; defaults to MCPTransport.STDIO. |
command |
Optional[str] |
no |
None |
Optional constructor field; defaults to None. |
args |
Optional[List[str]] |
no |
None |
Optional constructor field; defaults to None. |
env |
Optional[Dict[str, str]] |
no |
None |
Optional constructor field; defaults to None. |
url |
Optional[str] |
no |
None |
Optional constructor field; defaults to None. |
enabled |
bool |
no |
True |
Optional constructor field; defaults to True. |
timeout |
float |
no |
30.0 |
Optional constructor field; defaults to 30.0. |
Returns
- Constructs:
vllm_mlx.mcp.types.MCPServerConfig
Exceptions and behavior
Class MCPServerConfig declares 2 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.mcp.types.MCPServerConfig.__post_init__ · method
Validate configuration.
Parameters
This callable has no explicit inputs.
Returns
- Type:
not annotated
Exceptions and behavior
Method MCPServerConfig.__post_init__ updates self.transport; calls isinstance, MCPTransport, ValueError, self._validate_security; can raise ValueError.
Directly raised exceptions: ValueError.
vllm_mlx.mcp.types.MCPServerConfig._validate_security · method
Validate security of the configuration.
Parameters
This callable has no explicit inputs.
Returns
- Type:
None
Exceptions and behavior
Method MCPServerConfig._validate_security calls validate_mcp_server_config, ValueError, str; can raise ValueError.
Directly raised exceptions: ValueError.
vllm_mlx.mcp.types.MCPConfig · class
vllm_mlx.mcp.types.MCPConfig(servers: Dict[str, MCPServerConfig] = field(default_factory=dict), max_tool_calls: int = 10, default_timeout: float = 30.0, allowed_high_risk_tools: Set[str] = field(default_factory=set))
Root configuration for MCP client.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
servers |
Dict[str, MCPServerConfig] |
no |
field(default_factory=dict) |
Optional constructor field; defaults to field(default_factory=dict). |
max_tool_calls |
int |
no |
10 |
Optional constructor field; defaults to 10. |
default_timeout |
float |
no |
30.0 |
Optional constructor field; defaults to 30.0. |
allowed_high_risk_tools |
Set[str] |
no |
field(default_factory=set) |
Optional constructor field; defaults to field(default_factory=set). |
Returns
- Constructs:
vllm_mlx.mcp.types.MCPConfig
Exceptions and behavior
Class MCPConfig declares 1 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.mcp.types.MCPConfig.from_dict · method
Create config from dictionary.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
data |
Dict[str, Any] |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
'MCPConfig' - Direct return expressions:
cls(servers=servers, max_tool_calls=data.get('max_tool_calls', 10), default_timeout=data.get('default_timeout', 30.0), …
Exceptions and behavior
Method MCPConfig.from_dict calls data.get('servers', {}).items, data.get, MCPServerConfig, cls; returns cls(servers=servers, max_tool_calls=data.get('max_tool_calls', 10), default_timeout=data.get('default_timeout', 30.0), ….
No direct raise statement appears in this definition.
vllm_mlx.mcp.types.MCPTool · class
vllm_mlx.mcp.types.MCPTool(server_name: str, name: str, description: str, input_schema: Dict[str, Any] = field(default_factory=dict))
Normalized tool representation from MCP server.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
server_name |
str |
yes |
none |
Required constructor field. |
name |
str |
yes |
none |
Required constructor field. |
description |
str |
yes |
none |
Required constructor field. |
input_schema |
Dict[str, Any] |
no |
field(default_factory=dict) |
Optional constructor field; defaults to field(default_factory=dict). |
Returns
- Constructs:
vllm_mlx.mcp.types.MCPTool
Exceptions and behavior
Class MCPTool declares 2 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.mcp.types.MCPTool.full_name · method
Get namespaced tool name (server__tool).
Parameters
This callable has no explicit inputs.
Returns
- Type:
str - Direct return expressions:
f'{self.server_name}__{self.name}'
Exceptions and behavior
Method MCPTool.full_name returns f'{self.server_name}__{self.name}'.
No direct raise statement appears in this definition.
vllm_mlx.mcp.types.MCPTool.to_openai_format · method
Convert to OpenAI function calling format.
Parameters
This callable has no explicit inputs.
Returns
- Type:
Dict[str, Any] - Direct return expressions:
{'type': 'function', 'function': {'name': self.full_name, 'description': self.description, 'parameters': self.input_sch…
Exceptions and behavior
Method MCPTool.to_openai_format returns {'type': 'function', 'function': {'name': self.full_name, 'description': self.description, 'parameters': self.input_sch….
No direct raise statement appears in this definition.
vllm_mlx.mcp.types.MCPToolResult · class
vllm_mlx.mcp.types.MCPToolResult(tool_name: str, content: Any, is_error: bool = False, error_message: Optional[str] = None)
Result from a tool execution.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
tool_name |
str |
yes |
none |
Required constructor field. |
content |
Any |
yes |
none |
Required constructor field. |
is_error |
bool |
no |
False |
Optional constructor field; defaults to False. |
error_message |
Optional[str] |
no |
None |
Optional constructor field; defaults to None. |
Returns
- Constructs:
vllm_mlx.mcp.types.MCPToolResult
Exceptions and behavior
Class MCPToolResult declares 1 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.mcp.types.MCPToolResult.to_message · method
Convert to OpenAI tool result message format.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
tool_call_id |
str |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
Dict[str, Any] - Direct return expressions:
{'role': 'tool', 'tool_call_id': tool_call_id, 'content': content}
Exceptions and behavior
Method MCPToolResult.to_message calls isinstance, json.dumps; returns {'role': 'tool', 'tool_call_id': tool_call_id, 'content': content}.
No direct raise statement appears in this definition.
vllm_mlx.mcp.types.MCPServerStatus · class
vllm_mlx.mcp.types.MCPServerStatus(name: str, state: MCPServerState, transport: MCPTransport, tools_count: int = 0, error: Optional[str] = None, last_connected: Optional[float] = None)
Status of an MCP server connection.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name |
str |
yes |
none |
Required constructor field. |
state |
MCPServerState |
yes |
none |
Required constructor field. |
transport |
MCPTransport |
yes |
none |
Required constructor field. |
tools_count |
int |
no |
0 |
Optional constructor field; defaults to 0. |
error |
Optional[str] |
no |
None |
Optional constructor field; defaults to None. |
last_connected |
Optional[float] |
no |
None |
Optional constructor field; defaults to None. |
Returns
- Constructs:
vllm_mlx.mcp.types.MCPServerStatus
Exceptions and behavior
Class MCPServerStatus declares 1 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.mcp.types.MCPServerStatus.to_dict · method
Convert to dictionary for API response.
Parameters
This callable has no explicit inputs.
Returns
- Type:
Dict[str, Any] - Direct return expressions:
{'name': self.name, 'state': self.state.value, 'transport': self.transport.value, 'tools_count': self.tools_count, 'err…
Exceptions and behavior
Method MCPServerStatus.to_dict returns {'name': self.name, 'state': self.state.value, 'transport': self.transport.value, 'tools_count': self.tools_count, 'err….
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 |
|---|---|---|---|---|
MCPTransport |
class | MCPTransport() |
Supported MCP transport types. | #L11-L15 |
MCPServerState |
class | MCPServerState() |
MCP server connection states. | #L18-L24 |
MCPServerConfig |
class | MCPServerConfig(name: str, transport: MCPTransport = MCPTransport.STDIO, command: Optional[str] = None, args: Optional[List[str]] = None, env: Optional[Dict[str, str]] = None, url: Optional[str] = None, enabled: bool = True, timeout: float = 30.0) |
Configuration for a single MCP server. | #L28-L78 |
MCPServerConfig.__post_init__ |
method | MCPServerConfig.__post_init__() -> not annotated |
Validate configuration. | #L46-L63 |
MCPServerConfig._validate_security |
method | MCPServerConfig._validate_security() -> None |
Validate security of the configuration. | #L65-L78 |
MCPConfig |
class | MCPConfig(servers: Dict[str, MCPServerConfig] = field(default_factory=dict), max_tool_calls: int = 10, default_timeout: float = 30.0, allowed_high_risk_tools: Set[str] = field(default_factory=set)) |
Root configuration for MCP client. | #L82-L103 |
MCPConfig.from_dict |
method | MCPConfig.from_dict(data: Dict[str, Any]) -> 'MCPConfig' |
Create config from dictionary. | #L91-L103 |
MCPTool |
class | MCPTool(server_name: str, name: str, description: str, input_schema: Dict[str, Any] = field(default_factory=dict)) |
Normalized tool representation from MCP server. | #L107-L129 |
MCPTool.full_name |
method | MCPTool.full_name() -> str |
Get namespaced tool name (server__tool). | #L116-L118 |
MCPTool.to_openai_format |
method | MCPTool.to_openai_format() -> Dict[str, Any] |
Convert to OpenAI function calling format. | #L120-L129 |
MCPToolResult |
class | MCPToolResult(tool_name: str, content: Any, is_error: bool = False, error_message: Optional[str] = None) |
Result from a tool execution. | #L133-L156 |
MCPToolResult.to_message |
method | MCPToolResult.to_message(tool_call_id: str) -> Dict[str, Any] |
Convert to OpenAI tool result message format. | #L141-L156 |
MCPServerStatus |
class | MCPServerStatus(name: str, state: MCPServerState, transport: MCPTransport, tools_count: int = 0, error: Optional[str] = None, last_connected: Optional[float] = None) |
Status of an MCP server connection. | #L160-L179 |
MCPServerStatus.to_dict |
method | MCPServerStatus.to_dict() -> Dict[str, Any] |
Convert to dictionary for API response. | #L170-L179 |