The host package#
Summary#
MCP tool annotations (behavior hints) for the leaf tool surface. |
|
Uniform |
|
Make long-running mutating tool calls survive host timeouts. |
|
Per-call trace ids so host-side and server-side logs line up. |
Wrap tool functions with trace ids, timeout-safe execution and error guidance. |
|
Return the behavior hints for a tool. |
|
Classify an error code. |
|
Return the trace id of the tool call running in this context. |
Return whether the host contract should wrap tools. |
Environment variable that turns the host contract off when set to |
Description#
Host-facing contract for generic MCP hosts.
Generic MCP hosts (VS Code Copilot, Claude Desktop, Cursor) rely on:
behavior hints on every tool (
ansys.fluent.mcp.common.host.annotations);retryable/next_actionguidance on error results (ansys.fluent.mcp.common.host.guidance);long-running mutating calls that survive host timeouts (
ansys.fluent.mcp.common.host.operations);per-call trace ids in the server log (
ansys.fluent.mcp.common.host.trace).
HostContract applies all of this by wrapping each tool function at
registration time. It uses only the standard library, so this package does not
depend on the internals of the MCP server framework. Set
FLUIDS_MCP_HOST_CONTRACT=0 to turn it off.
Module detail#
- host.host_contract_enabled() bool#
Return whether the host contract should wrap tools.
- Returns:
- bool
Falseonly whenFLUIDS_MCP_HOST_CONTRACTis a falsy value.
- host.HOST_CONTRACT_ENV = 'FLUIDS_MCP_HOST_CONTRACT'#
Environment variable that turns the host contract off when set to
0.