errorResult wraps a message as a CallToolResult with IsError set. This is the MCP-spec way to tell the host that the tool *ran* but produced a recoverable error (vs the JSON-RPC-level error path which signals a protocol/transport failure).
(msg string)
| 217 | // recoverable error (vs the JSON-RPC-level error path which signals a |
| 218 | // protocol/transport failure). |
| 219 | func errorResult(msg string) *mcp.CallToolResult { |
| 220 | return &mcp.CallToolResult{ |
| 221 | IsError: true, |
| 222 | Content: []mcp.Content{&mcp.TextContent{Text: msg}}, |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | // isJSONNull returns true when the raw JSON encodes a literal `null`, with |
| 227 | // any surrounding whitespace tolerated. |