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

Method handleGetAttributeNames

modules/frontend/mcp_tools.go:268–289  ·  view source on GitHub ↗

handleGetAttributeNames handles the get-attribute-names tool

(ctx context.Context, request mcp.CallToolRequest)

Source from the content-addressed store, hash-verified

266
267// handleGetAttributeNames handles the get-attribute-names tool
268func (s *MCPServer) handleGetAttributeNames(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
269 metricMCPToolCalls.WithLabelValues(toolGetAttributeNames).Inc()
270
271 level.Info(s.logger).Log("msg", "getting attribute names")
272
273 searchTagsReq := &tempopb.SearchTagsRequest{
274 Scope: request.GetString("scope", ""),
275 }
276
277 req, err := api.BuildSearchTagsRequest(nil, searchTagsReq)
278 if err != nil {
279 return mcp.NewToolResultError(fmt.Sprintf("failed to build search request: %v", err)), nil
280 }
281 req.URL.Path = s.buildPath(api.PathSearchTagsV2)
282
283 body, err := handleHTTP(ctx, s.frontend.SearchTagsV2Handler, req)
284 if err != nil {
285 return mcp.NewToolResultError(err.Error()), nil
286 }
287
288 return toolResult(body, MetaTypeAttributeNames, "json", "2"), nil
289}
290
291// handleGetAttributeValues handles the get-attribute-values tool
292func (s *MCPServer) handleGetAttributeValues(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {

Callers 1

TestAcceptHeaderIsSetFunction · 0.95

Calls 7

buildPathMethod · 0.95
BuildSearchTagsRequestFunction · 0.92
handleHTTPFunction · 0.85
toolResultFunction · 0.70
IncMethod · 0.65
LogMethod · 0.65
ErrorMethod · 0.65

Tested by 1

TestAcceptHeaderIsSetFunction · 0.76