Skip to main content

run_json

Function run_json 

Source
pub async fn run_json<F>(
    tool: &str,
    check: Result<()>,
    fut: F,
) -> CallToolResult
where F: Future<Output = Result<Value>>,
Expand description

Run a permission check (or .and(...)-chained checks), then a future, and wrap the JSON result. Errors are surfaced as a CallToolResult with is_error: true (per MCP spec) rather than as a transport-level McpError, so an AI agent client can recover without aborting its loop.