Expand description
Outbound @mcp/<server> transport dispatch.
Every @mcp/<server>.<tool>(...) call lowers (in codegen) to one host
import — submilli:mcp.call(server, tool, argsJson) -> unknown. The host
converts the transport’s bounded JSON tree directly to guest objects; normal
runtime casts validate declared tool return types.
This module provides that host fn. It runs the mcp.<server> capability check
(one per server, with the tool in the filter context) before dispatch (a
denial throws before any network bytes leave), then
calls the embedder-provided McpTransport — the actual JSON-RPC tools/call,
auth injection, and refresh-on-401 live in the embedder (submilli-server),
keeping this crate free of its async/HTTP dependencies.
Structs§
- McpOutcome
- Completed transport work, retained even when the tool result is an error.
- McpResponse
- A JSON tree admitted before it crosses the transport/runtime boundary. Private ownership keeps both guest conversion and recursive destruction bounded.
Enums§
- McpCall
Error - Why an outbound MCP
tools/callfailed. The host fn maps each to a catchable script error (see [mcp_error_to_throw]).
Constants§
- MCP_
MAX_ RESPONSE_ BYTES - MCP_
MODULE_ NAME - The single internal host module every MCP call dispatches through.
Traits§
- McpTransport
- The embedder-provided outbound MCP transport: performs the JSON-RPC
tools/call(resolving auth, refreshing on401, reusing connections) and returns a bounded JSON tree. Transport decoders must bound response bytes and nesting before allocating recursive JSON values.
Functions§
- install_
mcp_ async - Install the async
submilli:mcp.calldispatch host fn. Reads(server, tool, argsJson), runs the capability check, dispatches throughStoreData::mcp_transport, and builds guest values directly from its tree. - mcp_
call_ package_ declaration - Codegen-facing definitions for the internal
submilli:mcp.callhost fn:call(server: string, tool: string, args: string): unknown. Lowered as(ref $string) x3 -> (ref null $Object)by the generic host-import path. - request_
digest - The digest the call log records for a call’s request: what a transport sees of it, so a transport can recognize a call it saw recorded.