MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / extractProtocolResult

Function extractProtocolResult

pkg/mcp/protocol_test.go:56–73  ·  view source on GitHub ↗
(t *testing.T, res *mcpmcp.CallToolResult)

Source from the content-addressed store, hash-verified

54}
55
56func 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

Calls 2

HelperMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected