part…
Building governance for MCP?
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
OpenTelemetry maintains semantic conventions specific to MCP (in the semantic-conventions-genai repository). Following them makes your traces and metrics comparable with those of the ecosystem's SDKs and tools.
SpanKind.CLIENT): when sending a request or notification; it covers until the response or acknowledgement is received.SpanKind.SERVER): when handling a request or notification initiated by the peer.{mcp.method.name} {target} where target is gen_ai.tool.name or gen_ai.prompt.name when applicable; if there is no low-cardinality target, just the method. Including mcp.resource.uri in the name is opt-in (high cardinality).tools/call are compatible with the GenAI execute_tool spans; if an outer GenAI instrumentation already traces the execution, the MCP one may enrich that span instead of creating another (opt-in).| Attribute | Requirement | Notes |
|---|---|---|
mcp.method.name |
Required | Method of the request or notification. |
error.type |
Conditionally required | JSON-RPC error code as a string; tool_error if the result has isError: true; _OTHER as fallback; timeouts and transport failures according to the general guidance. |
gen_ai.tool.name, gen_ai.prompt.name |
Conditionally required | Depending on the operation. |
gen_ai.operation.name |
execute_tool only on tool calls. |
|
jsonrpc.request.id |
Conditionally required on requests | Not recorded if it is null or omitted. |
jsonrpc.protocol.version |
Recommended if not 2.0. |
|
mcp.resource.uri |
Conditionally required on resource operations. | |
rpc.response.status_code |
Conditionally required when there is a JSON-RPC error. | |
mcp.protocol.version, mcp.session.id |
Recommended | session.id only makes sense in legacy. |
network.protocol.name/version, network.transport |
tcp/quic over HTTP, pipe over stdio. |
|
server.address, server.port (client) / client.address, client.port (server) |
Recommended | Behind intermediaries, the real server. |
gen_ai.prompt.variable.<name>, gen_ai.tool.call.arguments, gen_ai.tool.call.result |
Opt-in | Sensitive. |
ERROR, the description should be JSONRPCError.message.-32700, -32600, -32601, -32602 (including unknown tool) and -32002 are not marked as span errors (they are client errors); the rest are.mcp.client.operation.duration, mcp.server.operation.duration, mcp.client.session.duration, mcp.server.session.duration (histograms; the session ones apply to legacy).
traceparent (13.1).axium.policy.id, axium.decision) and business metrics (policy blocks, scope elevations, MRTR rounds).1. What value does error.type take when a tool returns isError: true?
The convention defines tool_error for tool execution errors.
2. On the server side, is a -32602 for an unknown tool marked as an error?
Invalid-request codes are not considered server errors on its span.
3. How is the span for a tools/call to get_weather named?
{mcp.method.name} {gen_ai.tool.name}.