The host package#

Summary#

annotations

MCP tool annotations (behavior hints) for the leaf tool surface.

guidance

Uniform retryable / next_action guidance on tool error results.

operations

Make long-running mutating tool calls survive host timeouts.

trace

Per-call trace ids so host-side and server-side logs line up.

HostContract

Wrap tool functions with trace ids, timeout-safe execution and error guidance.

annotations_for

Return the behavior hints for a tool.

error_guidance

Classify an error code.

current_trace_id

Return the trace id of the tool call running in this context.

host_contract_enabled

Return whether the host contract should wrap tools.

HOST_CONTRACT_ENV

Environment variable that turns the host contract off when set to 0.

Description#

Host-facing contract for generic MCP hosts.

Generic MCP hosts (VS Code Copilot, Claude Desktop, Cursor) rely on:

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

False only when FLUIDS_MCP_HOST_CONTRACT is a falsy value.

host.HOST_CONTRACT_ENV = 'FLUIDS_MCP_HOST_CONTRACT'#

Environment variable that turns the host contract off when set to 0.