get_span
Retrieve detailed span information and metrics using a specific span ID for enhanced observability and debugging of AI agent runs with AgentOps MCP.
Instructions
Get span information and metrics by span_id.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| span_id | Yes | Span ID |
Implementation Reference
- src/index.ts:311-326 (handler)The handler for the 'get_span' tool. It extracts the span_id from arguments, fetches span information and metrics via authenticated API requests to AgentOps, combines them, and returns the result as a JSON text content block.case "get_span": { const { span_id } = args as { span_id: string }; const [spanInfo, spanMetrics] = await Promise.all([ makeAuthenticatedRequest(`/public/v1/spans/${span_id}`), makeAuthenticatedRequest(`/public/v1/spans/${span_id}/metrics`), ]); const result = { ...spanInfo, metrics: spanMetrics }; return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:195-208 (registration)Registration of the 'get_span' tool in the list of available tools, including its name, description, and input schema requiring a 'span_id' string.{ name: "get_span", description: "Get span information and metrics by span_id.", inputSchema: { type: "object", properties: { span_id: { type: "string", description: "Span ID", }, }, required: ["span_id"], }, },
- src/index.ts:198-207 (schema)Input schema definition for the 'get_span' tool, specifying an object with a required 'span_id' string property.inputSchema: { type: "object", properties: { span_id: { type: "string", description: "Span ID", }, }, required: ["span_id"], },