Module: MCPClient::CalledToolDefinition
- Included in:
- HttpTransportBase
- Defined in:
- lib/mcp_client/called_tool_definition.rb
Overview
The tool definition a tools/call request went out under (MCP 2026-07-28
"Custom Headers from Tool Parameters"): the transport derives that
request's Mcp-Param-* headers from its tool list, so the definitions in
that list are the ones the call is made -- and answered -- under.
A host that re-resolves the tool afterwards, to validate the result
against the definition the call actually carried, reads it from here
instead of listing again: on a list the server bounds with ttlMs: 0 (or
one whose TTL expired during the call) another access re-fetches, and the
definition that comes back may not be the one the request went out with.
Every call gets a slot of its own, so a nested exchange cannot overwrite an outer call's definition: a Streamable HTTP response dispatches the notifications it carries synchronously, and a listener may call another tool on this very transport and thread before the outer call returns.
The slots are kept per thread and per transport, in a stack named after
the transport's object_id so that
ResultCaching#forget_transport_thread_state drops it with
everything else a discarded transport left behind.