Expand description
MCP helper functions — error and result formatting.
Functions§
- json_
result - Wrap a JSON value into a successful MCP call result.
- mcp_err
- Convert a crate
Errorinto an MCP protocol error with structured data. - run_
json - Run a permission check (or
.and(...)-chained checks), then a future, and wrap the JSON result. Errors are surfaced as aCallToolResultwithis_error: true(per MCP spec) rather than as a transport-levelMcpError, so an AI agent client can recover without aborting its loop. - run_
text - Like
run_jsonbut wraps a plain text result. - text_
result - Wrap a plain text string into a successful MCP call result.