(t *testing.T, res *mcpmcp.CallToolResult)
| 54 | } |
| 55 | |
| 56 | func extractProtocolResult(t *testing.T, res *mcpmcp.CallToolResult) map[string]any { |
| 57 | t.Helper() |
| 58 | if res == nil { |
| 59 | t.Fatal("nil CallToolResult") |
| 60 | } |
| 61 | if len(res.Content) == 0 { |
| 62 | t.Fatal("empty Content in CallToolResult") |
| 63 | } |
| 64 | tc, ok := res.Content[0].(mcpmcp.TextContent) |
| 65 | if !ok { |
| 66 | t.Fatalf("expected TextContent, got %T", res.Content[0]) |
| 67 | } |
| 68 | var out map[string]any |
| 69 | if err := json.Unmarshal([]byte(tc.Text), &out); err != nil { |
| 70 | t.Fatalf("JSON unmarshal: %v\nraw: %s", err, tc.Text) |
| 71 | } |
| 72 | return out |
| 73 | } |
| 74 | |
| 75 | // --- Tool Discovery --- |
| 76 |
no test coverage detected