MCPcopy
hub / github.com/grafana/tempo / createMCPClient

Function createMCPClient

integration/api/mcp_test.go:82–103  ·  view source on GitHub ↗
(t *testing.T, tempo *e2e.HTTPService)

Source from the content-addressed store, hash-verified

80}
81
82func createMCPClient(t *testing.T, tempo *e2e.HTTPService) mcpclient.MCPClient {
83 mcpClient, err := mcpclient.NewStreamableHttpClient("http://" + path.Join(tempo.Endpoint(3200), api.PathMCP))
84 require.NoError(t, err)
85
86 // Initialize the connection with required parameters
87 initReq := mcp.InitializeRequest{
88 Params: mcp.InitializeParams{
89 ProtocolVersion: mcp.LATEST_PROTOCOL_VERSION,
90 Capabilities: mcp.ClientCapabilities{},
91 ClientInfo: mcp.Implementation{
92 Name: "tempo-e2e-test",
93 Version: "1.0.0",
94 },
95 },
96 }
97 _, err = mcpClient.Initialize(context.Background(), initReq)
98 if err != nil {
99 t.Fatalf("failed to initialize MCP client: %v", err)
100 }
101
102 return mcpClient
103}
104
105func listTools(t *testing.T, mcpClient mcpclient.MCPClient) []mcp.Tool {
106 toolsResponse, err := mcpClient.ListTools(context.Background(), mcp.ListToolsRequest{})

Callers 1

TestMCPFunction · 0.85

Calls 1

JoinMethod · 0.65

Tested by

no test coverage detected