Summary
FastMCP's OTEL instrumentation has attribute gaps and non-standard attributes compared to the MCP Semantic Conventions. This issue tracks bringing the existing spans into spec compliance — no new spans, just fixing what we emit.
Missing required/conditionally-required attributes
Missing recommended attributes
Non-standard attributes to remove
The MCP semconv is standalone under gen-ai/ and explicitly recommends against RPC conventions:
"When instrumenting MCP calls, it's RECOMMENDED to follow MCP conventions instead of RPC semantic conventions"
Additionally, rpc.system was renamed to rpc.system.name and deprecated.
Error handling bugs
Methodology
Tested with console OTEL exporter (no vendor SDK) to capture raw spans. Full audit: https://github.com/strawgate/fastmcp-pr-review/blob/main/otel-audit.md
Summary
FastMCP's OTEL instrumentation has attribute gaps and non-standard attributes compared to the MCP Semantic Conventions. This issue tracks bringing the existing spans into spec compliance — no new spans, just fixing what we emit.
Missing required/conditionally-required attributes
gen_ai.tool.name— Conditionally required on tool operations. Currently not set. Should usetool.name(the public name), notfastmcp.component.key(internal registry key).gen_ai.prompt.name— Conditionally required on prompt operations. Same fix.error.type— Conditionally required on failure. Spec defines: JSON-RPC error code as string, ortool_errorwhenCallToolResult.isError=true. Currently not set anywhere.jsonrpc.request.id— Conditionally required when client executes a request. Not set.rpc.response.status_code— Conditionally required on error responses. The onlyrpc.*attribute the MCP semconv references. Not set.Missing recommended attributes
mcp.protocol.version— Recommended on both CLIENT and SERVERjsonrpc.protocol.version— Recommended. Should be"2.0"network.transport— Recommended. Should reflect transport type (pipe,tcp,inproc)server.address/server.port— Recommended on CLIENT spansmcp.session.idon CLIENT spans — Currently only set on SERVERNon-standard attributes to remove
The MCP semconv is standalone under
gen-ai/and explicitly recommends against RPC conventions:Additionally,
rpc.systemwas renamed torpc.system.nameand deprecated.rpc.system="mcp"— deprecated name, not in MCP semconvrpc.service— not in any spec, duplicatesfastmcp.server.namerpc.method— redundant withmcp.method.nameError handling bugs
ToolErroris raised in_parse_call_tool_result()(tools.py:393) afterclient_spanexits (tools.py:162). Span never sees the error.server_spancatches + records, then innercall_toolwraps inToolErrorand re-raises, triggering a second recording.Methodology
Tested with console OTEL exporter (no vendor SDK) to capture raw spans. Full audit: https://github.com/strawgate/fastmcp-pr-review/blob/main/otel-audit.md