To get answers about Google and Google Cloud remote MCP tool use, tool failures, and latency causes, you can use Cloud Trace. Cloud Trace can help you understand what paths were taken in the processing of a given request, and the errors that took place within the processing of the request. Cloud Trace can also help you when you're developing AI and non-AI applications or troubleshooting a failure. For more information, see Cloud Trace overview.
Example use-cases for Cloud Trace
You can use Cloud Trace to answer questions like the following:
- Which Google MCP servers and tools does your project invoke?
- Did your agent fail because it didn't identify the correct tool, or did the tool fail?
- Are there agents calling Google Cloud services over MCP that lack instrumentation?
- Was MCP request latency due to the MCP client, the network, or the MCP server?
Cloud Trace terminology
The following terminology is useful to understand when discussing Cloud Trace:
- Trace
- Represents a single end-to-end operation. Traces are composed of spans, which are records for a single function or unit of processing. For more information about traces and spans, see Traces and spans.
- Span
- A record of a unit of processing within the end-to-end operation. For more information about spans, see Span data model.
- Trace context
- Identifies the end-to-end trace with a Trace ID, identifies the parent operation for the current span with the Parent span ID, includes flags that determine the tracing behavior, such as sampling decisions, and contains additional information for advanced tracing behaviors in the State field. For more information about trace context, see Cloud Trace context.
- Context propagation
- Passing context information to Cloud Trace. Some instrumentation
libraries, such as OpenTelemetry (OTel), can propagate a
contextobject that contains the data necessary for tracing. For a list of OTel libraries that support tracing, see Language APIs & SDKs. - Sampling
- Whether or not data for a span is sent to Cloud Trace. Different sampling strategies are appropriate for different use-cases. For more information, read Cloud Trace Sampling.
Supported services
Not all remote MCP servers support Cloud Trace. To determine if a product supports Cloud Trace, refer to the list of Remote MCP servers that support Cloud Trace.
Limitations
MCP support for Cloud Trace has the following limitations:
- X-Cloud-Trace-Context and other non-W3C headers aren't supported. Only W3C headers are supported.
- MCP operations other than
tools/calldon't send spans to Cloud Trace. - Requests that are unauthenticated, unauthorized, or don't pass API enablement or other policy checks might not be included in the set of requests eligible to be traced.
Send trace spans to Cloud Trace
Remote MCP servers for Google and Google Cloud services generate trace spans
when tracing context is supplied and the sampled flag is set to
1.
You can provide tracing context in the following ways:
- In HTTP headers using the
traceparentheader. - In the MCP body using the
traceparentkey in theparams._metafield.
For more information, see Trace context.
Some libraries that interact with MCP can be configured to enable tracing. For example, you can instrument Agent Development Kit with OpenTelemetry.
For more information, read Instrument generative AI applications and Instrument for Cloud Trace.
View traces and spans
To view your MCP traces and spans, follow the instructions in Find and explore traces.
When you use the Trace Explorer, you can apply filters that let you view only the data that interests you. For data generated by MCP tools, you might want to filter by the resource, span, or scope attributes described in the following sections.
Resource attributes
The following table describes resource attributes:
| Attribute | Description |
|---|---|
cloud.account.id |
The ID of the Google Cloud billing project for the operation. |
cloud.provider |
The cloud service. This value is always gcp. |
gcp.mcp.server.id |
The Uniform Resource Name (URN) of the MCP server. |
gcp.project_id |
The ID of the Google Cloud project where the telemetry data is sent. |
Span attributes
The following table describes span attributes:
| Attribute | Description |
|---|---|
error.message |
Error message in the case of an error. |
error.type |
Low cardinality error type in the case of an error. |
gen_ai.operation.name |
The kind of Generative AI operation. For MCP, this value is always
execute_tool because the only supported operation is
tools/call. |
gen_ai.tool.name |
The name of the MCP tool that was invoked. |
jsonrpc.protocol.version |
The version of the JSON-RPC protocol. |
jsonrpc.request.id |
The unique ID used for the JSON-RPC invocation. |
mcp.method.name |
The MCP operation name. For example, tools/call. |
mcp.protocol.version |
The version of the MCP protocol used. |
Scope attributes
The following table describes scope attributes:
| Attribute | Description |
|---|---|
gcp.server.service |
The MCP server service name. For example, bigquery.googleapis.com. |
What's next
- Read about different instrumentation approaches for Cloud Trace.