Skip to main content
Glama
Systemores AI Agent & MCP Security Auditor

Systemores AI Agent & MCP Security Auditor

Analyze OpenTelemetry Agent Trace Spans

systemores_analyze_trace_telemetry
Read-onlyIdempotent

Analyze OpenTelemetry trace JSON to detect token cost burn traps, repeated-span sub-agent loop deadlocks, and per-span latency hotspots in multi-span MCP sessions.

Instructions

Analyzes an OpenTelemetry trace JSON payload (otelTraceJson, max 100,000 chars; span array or { spans, traceId } object) to summarize session token cost burn traps (default > $2.50), repeated-span sub-agent loop deadlocks, and per-span latency hotspots (default > 3000ms). Deterministic, stateless check requiring a Pro/Trial API key; returns rating CRITICAL on malformed JSON. Use for multi-span OTel/MCP trace logs; use systemores_measure_drag for single-turn character/latency math or systemores_audit_agent_graph for static topology analysis.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "otelTraceJson": "<otelTraceJson>"
    },
    "name": "systemores_analyze_trace_telemetry"
  }
}

Input Schema

NameRequiredDescriptionDefault
otelTraceJsonYesJSON string (max 100,000 chars) of OpenTelemetry spans — either a span array or an object with a 'spans' array and optional 'traceId'/'traceparent'.
latencyThresholdMsNoPer-span duration threshold in milliseconds above which a span is flagged as a latency hotspot (default 3000).
maxCostThresholdUsdNoMaximum allowable cost in USD per session before triggering burn trap alert.

Output Schema

NameRequiredDescriptionDefault
ratingYes
traceIdYes
recommendationsYes
estimatedCostUsdYes
latencyHotspotsMsYes
totalSpansEvaluatedYes
costBurnTrapDetectedYes
loopDeadlocksDetectedYes
traceContextPropagatedYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.2.2
    • changedInput schema / properties / latencyThresholdMs / description
      Previous value: -"Latency hotspot threshold in milliseconds."New value: +"Per-span duration threshold in milliseconds above which a span is flagged as a latency hotspot (default 3000)."
    • changedInput schema / properties / otelTraceJson / description
      Previous value: -"JSON string containing OpenTelemetry trace spans or MCP telemetry log data."New value: +"JSON string (max 100,000 chars) of OpenTelemetry spans — either a span array or an object with a 'spans' array and optional 'traceId'/'traceparent'."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "costBurnTrapDetected": {
      +      "type": "boolean"
      +    },
      +    "estimatedCostUsd": {
      +      "type": "number"
      +    },
      +    "latencyHotspotsMs": {
      +      "type": "array"
      +    },
      +    "loopDeadlocksDetected": {
      +      "type": "array"
      +    },
      +    "rating": {
      +      "enum": [
      +        "OPTIMIZED",
      +        "WARNING",
      +        "CRITICAL"
      +      ],
      +      "type": "string"
      +    },
      +    "recommendations": {
      +      "type": "array"
      +    },
      +    "totalSpansEvaluated": {
      +      "type": "integer"
      +    },
      +    "traceContextPropagated": {
      +      "type": "boolean"
      +    },
      +    "traceId": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "traceId",
      +    "traceContextPropagated",
      +    "totalSpansEvaluated",
      +    "estimatedCostUsd",
      +    "costBurnTrapDetected",
      +    "loopDeadlocksDetected",
      +    "latencyHotspotsMs",
      +    "rating",
      +    "recommendations"
      +  ],
      +  "type": "object"
      +}
  2. First observedv1.1.3

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations (readOnly, idempotent, closed-world, non-destructive), it discloses that the check is deterministic and stateless, that it requires a Pro/Trial API key, and that malformed JSON yields a CRITICAL rating rather than a hard failure. The only gap is that it does not characterize cost/rate-limit behavior of the analysis call itself.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose and detection targets, then constraints, then alternatives — a sensible information order with no filler. It is dense and parenthetical-heavy, but every clause carries operational meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists and the description need not explain return values, yet it still flags the malformed-JSON CRITICAL outcome. Combined with the auth requirement, size cap, and sibling routing, an agent has everything needed to call it correctly; only the output shape of the three findings is left implicit.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description restates the 100,000-char cap, the accepted payload shapes (span array or { spans, traceId }), and the default thresholds (>$2.50, >3000ms), but adds no semantics the schema does not already carry.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Names a specific verb ('Analyzes') and resource ('OpenTelemetry trace JSON payload') and enumerates the three concrete findings it produces: token cost burn traps, repeated-span sub-agent loop deadlocks, and per-span latency hotspots. It also names the sibling tools it is not, so an agent can distinguish it without opening schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly scopes usage to 'multi-span OTel/MCP trace logs' and routes two named alternatives: systemores_measure_drag for single-turn character/latency math and systemores_audit_agent_graph for static topology. The when-to-use and when-to-use-something-else conditions are both stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.