Tool: list_traces
Use this as the primary tool to retrieve and examine distributed traces from Google Cloud Trace. Traces provide a detailed view of the path of a request as it travels through your application's services. This is essential for understanding latency issues and debugging complex, multi-service workflows. This will only return the root trace span, to gather full information call get_trace with that id.
The following sample demonstrate how to use curl
to invoke the list_traces
MCP tool.
| Curl Request |
|---|
curl --location 'https://cloudtrace.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "list_traces", "arguments": { // provide these details according to the tool' s MCP specification } } , "jsonrpc" : "2.0" , "id" : 1 } ' |
Input Schema
The request message for the ListTraces
method. All fields are required unless specified.
ListTracesRequest
| JSON representation |
|---|
{
"projectId"
:
string
,
"view"
:
enum (
|
projectId
string
Required. ID of the Cloud project where the trace data is stored.
view
enum (
ViewType
)
Optional. Type of data returned for traces in the list. Default is MINIMAL
.
pageSize
integer
Optional. Maximum number of traces to return. If not specified or <= 0, the implementation selects a reasonable value. The implementation may return fewer traces than the requested page size.
pageToken
string
Token identifying the page of results to return. If provided, use the value of the next_page_token
field from a previous request.
startTime
string (
Timestamp
format)
Start of the time interval (inclusive) during which the trace data was collected from the application.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
endTime
string (
Timestamp
format)
End of the time interval (inclusive) during which the trace data was collected from the application.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
filter
string
Optional. A filter against properties of the trace. See filter syntax documentation for details.
orderBy
string
Optional. Field used to sort the returned traces. Can be one of the following:
-
trace_id -
name(namefield of root span in the trace) -
duration(difference betweenend_timeandstart_timefields of the root span) -
start(start_timefield of the root span)
Descending order can be specified by appending desc
to the sort field (for example, name desc
).
Only one sort field is permitted.
Timestamp
| JSON representation |
|---|
{ "seconds" : string , "nanos" : integer } |
| Fields | |
|---|---|
seconds
|
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos
|
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
Output Schema
The response message for the ListTraces
method.
ListTracesResponse
| JSON representation |
|---|
{
"traces"
:
[
{
object (
|
| Fields | |
|---|---|
traces[]
|
List of trace records as specified by the view parameter. |
nextPageToken
|
If defined, indicates that there are more traces that match the request and that this value should be passed to the next request to continue retrieving additional traces. |
Trace
| JSON representation |
|---|
{
"projectId"
:
string
,
"traceId"
:
string
,
"spans"
:
[
{
object (
|
| Fields | |
|---|---|
projectId
|
Project ID of the Cloud project where the trace data is stored. |
traceId
|
Globally unique identifier for the trace. This identifier is a 128-bit numeric value formatted as a 32-byte hex string. For example, |
spans[]
|
Collection of spans in the trace. |
TraceSpan
| JSON representation |
|---|
{
"spanId"
:
string
,
"kind"
:
enum (
|
| Fields | |
|---|---|
spanId
|
Identifier for the span. Must be a 64-bit integer other than 0 and unique within a trace. For example, |
kind
|
Distinguishes between spans generated in a particular context. For example, two spans with the same name may be distinguished using |
name
|
Name of the span. Must be less than 128 bytes. The span name is sanitized and displayed in the Trace tool in the Google Cloud Platform Console. The name may be a method name or some other per-call site name. For the same executable and the same call point, a best practice is to use a consistent name, which makes it easier to correlate cross-trace spans. |
startTime
|
Start time of the span in seconds and nanoseconds from the UNIX epoch. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
endTime
|
End time of the span in seconds and nanoseconds from the UNIX epoch. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
parentSpanId
|
Optional. ID of the parent span, if any. |
labels
|
Collection of labels associated with the span. Label keys must be less than 128 bytes. Label values must be less than 16 KiB. Some keys might have predefined meaning, and you can also create your own. For more information, see Cloud Trace labels . |
Timestamp
| JSON representation |
|---|
{ "seconds" : string , "nanos" : integer } |
| Fields | |
|---|---|
seconds
|
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos
|
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
LabelsEntry
| JSON representation |
|---|
{ "key" : string , "value" : string } |
| Fields | |
|---|---|
key
|
|
value
|
|
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌

