createMCPRequest is a helper function to create a MCP request with the given arguments.
(args any)
| 313 | |
| 314 | // createMCPRequest is a helper function to create a MCP request with the given arguments. |
| 315 | func createMCPRequest(args any) mcp.CallToolRequest { |
| 316 | // convert args to map[string]interface{} and serialize to JSON |
| 317 | argsMap, ok := args.(map[string]any) |
| 318 | if !ok { |
| 319 | argsMap = make(map[string]any) |
| 320 | } |
| 321 | |
| 322 | argsJSON, err := json.Marshal(argsMap) |
| 323 | if err != nil { |
| 324 | return mcp.CallToolRequest{} |
| 325 | } |
| 326 | |
| 327 | jsonRawMessage := json.RawMessage(argsJSON) |
| 328 | |
| 329 | return mcp.CallToolRequest{ |
| 330 | Params: &mcp.CallToolParamsRaw{ |
| 331 | Arguments: jsonRawMessage, |
| 332 | }, |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | // Well-known MCP client names used in tests. |
| 337 | const ( |
no outgoing calls
no test coverage detected