Expand description
Reusable protocol-level tool-error result shaping.
Bridges a structured JSON error payload into an MCP CallToolResult with
isError: true, and builds the generic “unknown tool” protocol error
every action-dispatch or router-style MCP server eventually needs.
Functions§
- tool_
error_ result - Wrap a structured tool-error JSON payload into an MCP
CallToolResult, truncating down to a small overflow envelope when the serialized payload would exceedmax_response_bytesso callers never emit invalid, mid-value-truncated JSON. - unknown_
tool_ error - Build a generic “unknown tool” protocol error for
call_tool/list_toolsdispatch, naming the offending tool and (when non-empty) the tools the server does expose.