Monitoring MCP agents with OpenTelemetry: tracing tool calls, attributes, latency and errors
AI assistants that call tools in production can slow down or pick wrong tools without triggering classic alerts, so monitoring is needed. An MCP tool call behaves like a distributed operation, letting teams apply familiar distributed tracing if they choose consistent span names and attributes. OpenTelemetry offers a vendor-neutral format, shared GenAI semantic conventions, and context propagation that links agents, MCP servers and downstream services in one trace. Spans are named after the MCP method and tool, and carry attributes such as the method name, tool name, session ID and error type, while arguments and results are optional because they may contain sensitive data. Because HTTP headers are insufficient, trace context is injected into the params._meta field of each MCP request, and the official Python SDK version 2 already emits server spans, requiring only an SDK and an OTLP exporter to collect them.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in