handleGetAttributeNames handles the get-attribute-names tool
(ctx context.Context, request mcp.CallToolRequest)
| 266 | |
| 267 | // handleGetAttributeNames handles the get-attribute-names tool |
| 268 | func (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 |
| 292 | func (s *MCPServer) handleGetAttributeValues(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { |