toolResult marshals a map[string]any result into an MCP CallToolResult.
(data map[string]any)
| 240 | |
| 241 | // toolResult marshals a map[string]any result into an MCP CallToolResult. |
| 242 | func toolResult(data map[string]any) (*mcpmcp.CallToolResult, error) { |
| 243 | b, err := json.Marshal(data) |
| 244 | if err != nil { |
| 245 | return nil, fmt.Errorf("failed to marshal result: %w", err) |
| 246 | } |
| 247 | return mcpmcp.NewToolResultText(string(b)), nil |
| 248 | } |
| 249 | |
| 250 | // --------------------------------------------------------------------------- |
| 251 | // MCP handler functions |