Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(tracing): add excludeAttributes to span query to shrink payloads (#61404)

Jon McCallum035bc59cb77f
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 83c33e7891ff..11f1433d92a7 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -40583,6 +40583,10 @@
"dateRange": {
"$ref": "#/definitions/DateRange"
},
+ "excludeAttributes": {
+ "description": "Omit the per-span `attributes` map from results to keep payloads compact",
+ "type": "boolean"
+ },
"filterGroup": {
"$ref": "#/definitions/PropertyGroupFilter"
},
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 4757f9d62b2d..cbc37f70b415 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -3191,6 +3191,8 @@ export interface TraceSpansQuery extends DataNode<TraceSpansQueryResponse> {
after?: string
/** Prefetch up to this many spans per trace and include them in results */
prefetchSpans?: integer
+ /** Omit the per-span `attributes` map from results to keep payloads compact */
+ excludeAttributes?: boolean
}
export interface TraceSpansQueryResponse extends AnalyticsQueryResponseBase {
diff --git a/posthog/schema.py b/posthog/schema.py
index d3a041bffaed..9045a9a45fd5 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -23423,6 +23423,10 @@ class TraceSpansQuery(BaseModel):
)
after: str | None = Field(default=None, description="Cursor for fetching the next page of results")
dateRange: DateRange
+ excludeAttributes: bool | None = Field(
+ default=None,
+ description=("Omit the per-span `attributes` map from results to keep payloads compact"),
+ )
filterGroup: PropertyGroupFilter | None = None
kind: Literal["TraceSpansQuery"] = "TraceSpansQuery"
limit: int | None = None
diff --git a/products/tracing/backend/logic.py b/products/tracing/backend/logic.py
index e93352e99c38..3c60fd03587f 100644
--- a/products/tracing/backend/logic.py
+++ b/products/tracing/backend/logic.py
@@ -479,7 +479,7 @@ class TraceSpansQueryRunner(TraceSpansQueryRunnerMixin, AnalyticsQueryRunner[Tra
is_root_span,
{where} as matched_filter,
min(if({where_for_start}, timestamp, NULL)) OVER (PARTITION BY trace_id) as trace_start,
- attributes
+ {attributes}
FROM posthog.trace_spans
WHERE {filters} AND {root_filter} AND trace_id IN ({trace_id_query}) LIMIT {limit}
""",
@@ -490,6 +490,10 @@ class TraceSpansQueryRunner(TraceSpansQueryRunnerMixin, AnalyticsQueryRunner[Tra
"limit": ast.Constant(value=(self.query.limit or 1) * limit_by_n),
"filters": ast.Placeholder(expr=ast.Field(chain=["filters"])),
"root_filter": parse_expr("is_root_span = 1") if root_only else ast.Constant(value=True),
+ # The attribute map dominates payload size (db.statement holds multi-KB SQL). When
+ # excluded we still SELECT a column so the positional result mapping stays stable —
+ # an empty map instead of the real one.
+ "attributes": parse_expr("map() AS attributes" if self.query.excludeAttributes else "attributes"),
},
)
assert isinstance(query, ast.SelectQuery)
diff --git a/products/tracing/backend/presentation/views.py b/products/tracing/backend/presentation/views.py
index 76fba0bb65e4..53d519daa622 100644
--- a/products/tracing/backend/presentation/views.py
+++ b/products/tracing/backend/presentation/views.py
@@ -142,6 +142,11 @@ class _TracingQueryBodySerializer(serializers.Serializer):
required=False,
help_text="Number of child spans to prefetch per trace (1-100).",
)
+ excludeAttributes = serializers.BooleanField(
+ required=False,
+ default=False,
+ help_text="Omit the per-span attributes map from results to keep payloads compact. Defaults to false.",
+ )
class _TracingQueryRequestSerializer(serializers.Serializer):
@@ -153,6 +158,11 @@ class _TracingTraceRequestSerializer(serializers.Serializer):
required=False,
help_text="Date range for the query. Defaults to last 24 hours.",
)
+ excludeAttributes = serializers.BooleanField(
+ required=False,
+ default=False,
+ help_text="Omit the per-span attributes map from results to keep payloads compact. Defaults to false.",
+ )
class _TracingServiceNamesQuerySerializer(serializers.Serializer):
@@ -355,6 +365,7 @@ class SpansViewSet(TeamAndOrgViewSetMixin, PydanticModelMixin, viewsets.ViewSet)
after=after_cursor,
rootSpans=query_data.get("rootSpans", True),
prefetchSpans=prefetch_spans,
+ excludeAttributes=query_data.get("excludeAttributes", False),
)
runner = TraceSpansQueryRunner(spans_query, self.team)
@@ -569,6 +580,7 @@ class SpansViewSet(TeamAndOrgViewSetMixin, PydanticModelMixin, viewsets.ViewSet)
limit=1000,
prefetchSpans=2000,
rootSpans=False,
+ excludeAttributes=query_data.get("excludeAttributes", False),
)
runner = TraceSpansQueryRunner(spans_query, self.team)
diff --git a/products/tracing/backend/tests/test_exclude_attributes.py b/products/tracing/backend/tests/test_exclude_attributes.py
new file mode 100644
index 000000000000..892361daf297
--- /dev/null
+++ b/products/tracing/backend/tests/test_exclude_attributes.py
@@ -0,0 +1,79 @@
+import base64
+import datetime as dt
+
+from posthog.test.base import APIBaseTest, ClickhouseTestMixin
+
+from parameterized import parameterized
+
+from posthog.schema import DateRange, TraceSpansQuery
+
+from posthog.clickhouse.client import sync_execute
+from posthog.clickhouse.query_tagging import tag_queries
+from posthog.clickhouse.traces.spans import TRACE_SPANS_DISTRIBUTED_TABLE_SQL, TRACE_SPANS_TABLE_SQL
+
+from products.tracing.backend.logic import TraceSpansQueryRunner
+
+DATE_FROM = "2026-06-02T07:00:00Z"
+DATE_TO = "2026-06-02T09:00:00Z"
+
+
+def _b64(raw: bytes) -> str:
+ return base64.b64encode(raw).decode("ascii")
+
+
+class TestExcludeAttributes(ClickhouseTestMixin, APIBaseTest):
+ CLASS_DATA_LEVEL_SETUP = True
+
+ @classmethod
+ def setUpTestData(cls):
+ super().setUpTestData()
+ tag_queries(product="tracing", feature="query")
+ sync_execute("DROP TABLE IF EXISTS trace_spans_distributed")
+ sync_execute("DROP TABLE IF EXISTS trace_spans")
+ sync_execute(TRACE_SPANS_TABLE_SQL())
+ sync_execute(
+ "ALTER TABLE trace_spans ADD COLUMN IF NOT EXISTS "
+ "is_root_span Bool MATERIALIZED (replaceAll(trimRight(parent_span_id, '='), 'A', '')) = ''"
+ )
+ sync_execute(TRACE_SPANS_DISTRIBUTED_TABLE_SQL())
+
+ ts_str = dt.datetime(2026, 6, 2, 8, 0, 0).strftime("%Y-%m-%d %H:%M:%S.%f")
+ # `attributes` is an ALIAS over attributes_map_str whose keys carry a `__str` type suffix
+ # that left(k, -5) strips — so 'http.method__str' surfaces as 'http.method'.
+ sync_execute(
+ "INSERT INTO trace_spans (uuid, team_id, trace_id, span_id, parent_span_id, name, kind, "
+ "timestamp, end_time, observed_timestamp, status_code, service_name, attributes_map_str) VALUES "
+ "("
+ f"'019e8754-0000-0000-0000-000000000001', {cls.team.id}, '{_b64((1).to_bytes(16, 'big'))}', "
+ f"'{_b64((1).to_bytes(8, 'big'))}', '', 'GET /api', 2, '{ts_str}', '{ts_str}', '{ts_str}', 0, 'web', "
+ "map('http.method__str', 'POST'))"
+ )
+
+ @classmethod
+ def tearDownClass(cls):
+ sync_execute("DROP TABLE IF EXISTS trace_spans_distributed")
+ sync_execute("DROP TABLE IF EXISTS trace_spans")
+ sync_execute(TRACE_SPANS_TABLE_SQL())
+ sync_execute(TRACE_SPANS_DISTRIBUTED_TABLE_SQL())
+ super().tearDownClass()
+
+ def _run(self, *, exclude: bool) -> list[dict]:
+ query = TraceSpansQuery(
+ dateRange=DateRange(date_from=DATE_FROM, date_to=DATE_TO),
+ orderBy="latest",
+ limit=100,
+ excludeAttributes=exclude,
+ )
+ return TraceSpansQueryRunner(query, self.team).run().results
+
+ @parameterized.expand(
+ [
+ # excludeAttributes=False keeps the populated attribute map.
+ ("included_by_default", False, {"http.method": "POST"}),
+ # excludeAttributes=True: key stays present (positional mapping is stable) but the map is empty.
+ ("omitted_when_excluded", True, {}),
+ ]
+ )
+ def test_attributes(self, _name, exclude, expected_attributes):
+ results = self._run(exclude=exclude)
+ self.assertEqual(results[0]["attributes"], expected_attributes)
diff --git a/products/tracing/frontend/generated/api.schemas.ts b/products/tracing/frontend/generated/api.schemas.ts
index 218309bbb022..e706030132a0 100644
--- a/products/tracing/frontend/generated/api.schemas.ts
+++ b/products/tracing/frontend/generated/api.schemas.ts
@@ -154,6 +154,8 @@ export interface _TracingQueryBodyApi {
rootSpans?: boolean
/** Number of child spans to prefetch per trace (1-100). */
prefetchSpans?: number
+ /** Omit the per-span attributes map from results to keep payloads compact. Defaults to false. */
+ excludeAttributes?: boolean
}
export interface _TracingQueryRequestApi {
@@ -164,6 +166,8 @@ export interface _TracingQueryRequestApi {
export interface _TracingTraceRequestApi {
/** Date range for the query. Defaults to last 24 hours. */
dateRange?: _TracingDateRangeApi
+ /** Omit the per-span attributes map from results to keep payloads compact. Defaults to false. */
+ excludeAttributes?: boolean
}
export interface _TracingTreeQueryBodyApi {
diff --git a/products/tracing/frontend/generated/api.zod.ts b/products/tracing/frontend/generated/api.zod.ts
index 89c75a0d2c50..05d034d2aa3e 100644
--- a/products/tracing/frontend/generated/api.zod.ts
+++ b/products/tracing/frontend/generated/api.zod.ts
@@ -102,6 +102,7 @@ export const TracingSpansAggregateCreateBody = /* @__PURE__ */ zod.object({
export const tracingSpansQueryCreateBodyQueryOneFilterGroupDefault = []
export const tracingSpansQueryCreateBodyQueryOneLimitDefault = 100
export const tracingSpansQueryCreateBodyQueryOneRootSpansDefault = true
+export const tracingSpansQueryCreateBodyQueryOneExcludeAttributesDefault = false
export const TracingSpansQueryCreateBody = /* @__PURE__ */ zod.object({
query: zod
@@ -186,6 +187,10 @@ export const TracingSpansQueryCreateBody = /* @__PURE__ */ zod.object({
.default(tracingSpansQueryCreateBodyQueryOneRootSpansDefault)
.describe('Filter to root spans only. Defaults to true.'),
prefetchSpans: zod.number().optional().describe('Number of child spans to prefetch per trace (1-100).'),
+ excludeAttributes: zod
+ .boolean()
+ .default(tracingSpansQueryCreateBodyQueryOneExcludeAttributesDefault)
+ .describe('Omit the per-span attributes map from results to keep payloads compact. Defaults to false.'),
})
.describe('The tracing spans query to execute.'),
})
@@ -193,6 +198,7 @@ export const TracingSpansQueryCreateBody = /* @__PURE__ */ zod.object({
export const tracingSpansSparklineCreateBodyQueryOneFilterGroupDefault = []
export const tracingSpansSparklineCreateBodyQueryOneLimitDefault = 100
export const tracingSpansSparklineCreateBodyQueryOneRootSpansDefault = true
+export const tracingSpansSparklineCreateBodyQueryOneExcludeAttributesDefault = false
export const TracingSpansSparklineCreateBody = /* @__PURE__ */ zod.object({
query: zod
@@ -277,10 +283,16 @@ export const TracingSpansSparklineCreateBody = /* @__PURE__ */ zod.object({
.default(tracingSpansSparklineCreateBodyQueryOneRootSpansDefault)
.describe('Filter to root spans only. Defaults to true.'),
prefetchSpans: zod.number().optional().describe('Number of child spans to prefetch per trace (1-100).'),
+ excludeAttributes: zod
+ .boolean()
+ .default(tracingSpansSparklineCreateBodyQueryOneExcludeAttributesDefault)
+ .describe('Omit the per-span attributes map from results to keep payloads compact. Defaults to false.'),
})
.describe('The tracing spans query to execute.'),
})
+export const tracingSpansTraceCreateBodyExcludeAttributesDefault = false
+
export const TracingSpansTraceCreateBody = /* @__PURE__ */ zod.object({
dateRange: zod
.object({
@@ -297,6 +309,10 @@ export const TracingSpansTraceCreateBody = /* @__PURE__ */ zod.object({
})
.optional()
.describe('Date range for the query. Defaults to last 24 hours.'),
+ excludeAttributes: zod
+ .boolean()
+ .default(tracingSpansTraceCreateBodyExcludeAttributesDefault)
+ .describe('Omit the per-span attributes map from results to keep payloads compact. Defaults to false.'),
})
export const tracingSpansTreeCreateBodyQueryOneCompareFilterOneCompareDefault = false
diff --git a/products/tracing/mcp/prompts/query-apm-spans.md b/products/tracing/mcp/prompts/query-apm-spans.md
index 4dbf2878480a..85a9f67e25b5 100644
--- a/products/tracing/mcp/prompts/query-apm-spans.md
+++ b/products/tracing/mcp/prompts/query-apm-spans.md
@@ -90,6 +90,10 @@ Cursor for pagination. Use the `nextCursor` value from the previous response.
Number of spans to return per matching trace (1-100), root span first. Useful to preview trace structure without a separate `apm-trace-get`. With the default (1) you get one span per trace (the root); raise it to also pull the matching children and their siblings (check `matched_filter` to tell them apart). Ignored when `rootSpans: true`, which always returns just the root.
+## query.excludeAttributes
+
+Set `true` to drop the per-span `attributes` map from results (the map stays present but empty). The attribute map holds multi-KB values like `db.statement`, so excluding it keeps large result sets compact — set it when you only need span structure/timing (`name`, `service_name`, `duration_nano`, `parent_span_id`) and not the OTel attributes. Defaults to false.
+
# Examples
## List recent error spans
diff --git a/products/tracing/mcp/tools.yaml b/products/tracing/mcp/tools.yaml
index 184ee1e76966..67e1a025cc94 100644
--- a/products/tracing/mcp/tools.yaml
+++ b/products/tracing/mcp/tools.yaml
@@ -118,8 +118,9 @@ tools:
title: Retrieve trace spans
description: >
Fetch all spans for a specific trace by its hex trace ID. Returns the full span tree for the trace including
- parent-child relationships, timing, and status information. Use this to inspect a specific trace in detail
- after discovering it via the query tool.
+ parent-child relationships, timing, status information, and each span's attributes map. Use this to inspect
+ a specific trace in detail after discovering it via the query tool. Set excludeAttributes to true to drop
+ the per-span attributes map (which can hold multi-KB values like db.statement) and keep the payload compact.
ui_app: trace-span-list
feature_flag: tracing
response:
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index dfe1980eec68..cec2a11a99eb 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -476,7 +476,7 @@
"feature_flag": "tracing"
},
"apm-trace-get": {
- "description": "Fetch all spans for a specific trace by its hex trace ID. Returns the full span tree for the trace including parent-child relationships, timing, and status information. Use this to inspect a specific trace in detail after discovering it via the query tool.",
+ "description": "Fetch all spans for a specific trace by its hex trace ID. Returns the full span tree for the trace including parent-child relationships, timing, status information, and each span's attributes map. Use this to inspect a specific trace in detail after discovering it via the query tool. Set excludeAttributes to true to drop the per-span attributes map (which can hold multi-KB values like db.statement) and keep the payload compact.",
"category": "Tracing",
"feature": "tracing",
"summary": "Retrieve trace spans",
@@ -4225,7 +4225,7 @@
}
},
"query-apm-spans": {
- "description": "Query trace spans with filtering by service name, status code, date range, and structured attribute filters. Supports cursor-based pagination. Returns spans with uuid, trace_id, span_id, parent_span_id, name, kind, service_name, status_code, timestamp, end_time, duration_nano, is_root_span, matched_filter, and attributes (the span-level OTel attribute map, e.g. db.statement, http.url).\n\nUse 'apm-attributes-list' and 'apm-attribute-values-list' to discover available attributes before building filters. Use 'apm-services-list' to discover available services.\n\n# Return shape\n\nResults are **grouped by trace**, not a flat list of matching spans. For each trace that contains at least one span matching your filters, the response includes spans from that trace (up to `prefetchSpans` per trace, root span first). Two fields tell you which spans actually matched:\n\n- `matched_filter` — `1` if **this span** satisfies your `filterGroup`/`serviceNames`/`statusCodes`, `0` if it's only included because it shares a trace with a match (e.g. a prefetched sibling or the trace's root). When you filter by a child span's name, the matching child has `matched_filter: 1` and its root/siblings have `matched_filter: 0`.\n- `is_root_span` — `true` for the trace's entry span.\n\nTo collapse each matching trace to a **single row — its root span**, set `rootSpans: true` — see below. (The row is the trace's entry span, which may itself carry `matched_filter: 0` when the match was on a child.) To inspect a single trace's full tree, take a `trace_id` from the results and call `apm-trace-get`.\n\nCRITICAL: Be minimalist. Only include filters and settings that are essential to answer the user's specific question. Default settings are usually sufficient unless the user explicitly requests customization.\n\nAll parameters must be nested inside a `query` object.\n\n# Data narrowing\n\n## Property filters\n\nUse property filters via the `query.filterGroup` field to narrow results. Only include property filters when they are essential to directly answer the user's question.\n\nWhen using a property filter, you should:\n\n- **Choose the right type.** Span property types are:\n - `span` — filters built-in span fields (trace_id, span_id, duration, name, kind, status_code).\n - `span_attribute` — filters span-level attributes (e.g. \"http.method\", \"http.status_code\").\n - `span_resource_attribute` — filters resource-level attributes (e.g. k8s labels, deployment info).\n- **Use `apm-attributes-list` to discover available attribute keys** before building filters.\n- **Use `apm-attribute-values-list` to discover valid values** for a specific attribute key.\n- **Find the suitable operator for the value type** (see supported operators below).\n\nSupported operators:\n\n- String: `exact`, `is_not`, `icontains`, `not_icontains`, `regex`, `not_regex`\n- Numeric: `exact`, `gt`, `lt`\n- Existence (no value needed): `is_set`, `is_not_set`\n\nThe `value` field accepts a string, number, or array of strings depending on the operator. Omit `value` for `is_set`/`is_not_set`.\n\n## Time period\n\nUse the `query.dateRange` field to control the time window. If the question doesn't mention time, the default is the last hour (`-1h`). Examples of relative dates: `-1h`, `-6h`, `-1d`, `-7d`, `-30d`.\n\n# Parameters\n\nAll parameters go inside `query`.\n\n## query.serviceNames\n\nFilter by service names. Use `apm-services-list` to discover available services.\n\n## query.statusCodes\n\nFilter by HTTP status codes (list of integers).\n\n## query.orderBy\n\nSort by timestamp: `latest` (default) or `earliest`.\n\n## query.filterGroup\n\nA list of property filters to narrow results. Each filter specifies `key`, `operator`, `type` (span/span_attribute/span_resource_attribute), and optionally `value`. See the \"Property filters\" section above.\n\n## query.dateRange\n\nDate range to filter results. Defaults to the last hour (`-1h`).\n\n- `date_from`: Start of the range. Accepts ISO 8601 timestamps or relative formats: `-1h`, `-6h`, `-1d`, `-7d`, `-30d`.\n- `date_to`: End of the range. Same format. Omit or null for \"now\".\n\n## query.traceId\n\nFilter to a specific trace ID (hex string). Use this when you already know the trace ID.\n\n## query.rootSpans\n\nSet `true` to return **only root spans** — one entry span per matching trace, which collapses each trace to a single row. Useful for \"list the traces matching X\" without sifting through `matched_filter`. Leave unset (or `false`) to get all spans of matching traces, where you read `matched_filter` to find the ones that matched. The frontend leaves this unset.\n\n## query.limit\n\nMaximum number of results (1-1000). Defaults to 100.\n\n## query.after\n\nCursor for pagination. Use the `nextCursor` value from the previous response.\n\n## query.prefetchSpans\n\nNumber of spans to return per matching trace (1-100), root span first. Useful to preview trace structure without a separate `apm-trace-get`. With the default (1) you get one span per trace (the root); raise it to also pull the matching children and their siblings (check `matched_filter` to tell them apart). Ignored when `rootSpans: true`, which always returns just the root.\n\n# Examples\n\n## List recent error spans\n\n```json\n{\n \"query\": {\n \"statusCodes\": [500, 503]\n }\n}\n```\n\n## Search spans from a specific service\n\n```json\n{\n \"query\": {\n \"serviceNames\": [\"api-gateway\"],\n \"dateRange\": { \"date_from\": \"-1d\" }\n }\n}\n```\n\n## Filter by a span attribute\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"http.method\", \"operator\": \"exact\", \"type\": \"span_attribute\", \"value\": \"POST\" }],\n \"dateRange\": { \"date_from\": \"-6h\" }\n }\n}\n```\n\n## Find slow spans\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"duration\", \"operator\": \"gt\", \"type\": \"span\", \"value\": \"1000000000\" }],\n \"dateRange\": { \"date_from\": \"-1d\" }\n }\n}\n```\n\n## Combine service and attribute filters\n\n```json\n{\n \"query\": {\n \"serviceNames\": [\"web-server\"],\n \"filterGroup\": [{ \"key\": \"http.status_code\", \"operator\": \"gt\", \"type\": \"span_attribute\", \"value\": \"399\" }],\n \"dateRange\": { \"date_from\": \"-12h\" }\n }\n}\n```\n\n## Check if a resource attribute exists\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"k8s.pod.name\", \"operator\": \"is_set\", \"type\": \"span_resource_attribute\" }]\n }\n}\n```\n\n# Reminders\n\n- Ensure that any property filters are directly relevant to the user's question. Avoid unnecessary filtering.\n- Use `apm-attributes-list` and `apm-attribute-values-list` to discover attributes before guessing filter keys/values.\n- Use `apm-services-list` to discover available services before filtering by service name.\n- Duration values are in nanoseconds (1 second = 1,000,000,000 nanoseconds).",
+ "description": "Query trace spans with filtering by service name, status code, date range, and structured attribute filters. Supports cursor-based pagination. Returns spans with uuid, trace_id, span_id, parent_span_id, name, kind, service_name, status_code, timestamp, end_time, duration_nano, is_root_span, matched_filter, and attributes (the span-level OTel attribute map, e.g. db.statement, http.url).\n\nUse 'apm-attributes-list' and 'apm-attribute-values-list' to discover available attributes before building filters. Use 'apm-services-list' to discover available services.\n\n# Return shape\n\nResults are **grouped by trace**, not a flat list of matching spans. For each trace that contains at least one span matching your filters, the response includes spans from that trace (up to `prefetchSpans` per trace, root span first). Two fields tell you which spans actually matched:\n\n- `matched_filter` — `1` if **this span** satisfies your `filterGroup`/`serviceNames`/`statusCodes`, `0` if it's only included because it shares a trace with a match (e.g. a prefetched sibling or the trace's root). When you filter by a child span's name, the matching child has `matched_filter: 1` and its root/siblings have `matched_filter: 0`.\n- `is_root_span` — `true` for the trace's entry span.\n\nTo collapse each matching trace to a **single row — its root span**, set `rootSpans: true` — see below. (The row is the trace's entry span, which may itself carry `matched_filter: 0` when the match was on a child.) To inspect a single trace's full tree, take a `trace_id` from the results and call `apm-trace-get`.\n\nCRITICAL: Be minimalist. Only include filters and settings that are essential to answer the user's specific question. Default settings are usually sufficient unless the user explicitly requests customization.\n\nAll parameters must be nested inside a `query` object.\n\n# Data narrowing\n\n## Property filters\n\nUse property filters via the `query.filterGroup` field to narrow results. Only include property filters when they are essential to directly answer the user's question.\n\nWhen using a property filter, you should:\n\n- **Choose the right type.** Span property types are:\n - `span` — filters built-in span fields (trace_id, span_id, duration, name, kind, status_code).\n - `span_attribute` — filters span-level attributes (e.g. \"http.method\", \"http.status_code\").\n - `span_resource_attribute` — filters resource-level attributes (e.g. k8s labels, deployment info).\n- **Use `apm-attributes-list` to discover available attribute keys** before building filters.\n- **Use `apm-attribute-values-list` to discover valid values** for a specific attribute key.\n- **Find the suitable operator for the value type** (see supported operators below).\n\nSupported operators:\n\n- String: `exact`, `is_not`, `icontains`, `not_icontains`, `regex`, `not_regex`\n- Numeric: `exact`, `gt`, `lt`\n- Existence (no value needed): `is_set`, `is_not_set`\n\nThe `value` field accepts a string, number, or array of strings depending on the operator. Omit `value` for `is_set`/`is_not_set`.\n\n## Time period\n\nUse the `query.dateRange` field to control the time window. If the question doesn't mention time, the default is the last hour (`-1h`). Examples of relative dates: `-1h`, `-6h`, `-1d`, `-7d`, `-30d`.\n\n# Parameters\n\nAll parameters go inside `query`.\n\n## query.serviceNames\n\nFilter by service names. Use `apm-services-list` to discover available services.\n\n## query.statusCodes\n\nFilter by HTTP status codes (list of integers).\n\n## query.orderBy\n\nSort by timestamp: `latest` (default) or `earliest`.\n\n## query.filterGroup\n\nA list of property filters to narrow results. Each filter specifies `key`, `operator`, `type` (span/span_attribute/span_resource_attribute), and optionally `value`. See the \"Property filters\" section above.\n\n## query.dateRange\n\nDate range to filter results. Defaults to the last hour (`-1h`).\n\n- `date_from`: Start of the range. Accepts ISO 8601 timestamps or relative formats: `-1h`, `-6h`, `-1d`, `-7d`, `-30d`.\n- `date_to`: End of the range. Same format. Omit or null for \"now\".\n\n## query.traceId\n\nFilter to a specific trace ID (hex string). Use this when you already know the trace ID.\n\n## query.rootSpans\n\nSet `true` to return **only root spans** — one entry span per matching trace, which collapses each trace to a single row. Useful for \"list the traces matching X\" without sifting through `matched_filter`. Leave unset (or `false`) to get all spans of matching traces, where you read `matched_filter` to find the ones that matched. The frontend leaves this unset.\n\n## query.limit\n\nMaximum number of results (1-1000). Defaults to 100.\n\n## query.after\n\nCursor for pagination. Use the `nextCursor` value from the previous response.\n\n## query.prefetchSpans\n\nNumber of spans to return per matching trace (1-100), root span first. Useful to preview trace structure without a separate `apm-trace-get`. With the default (1) you get one span per trace (the root); raise it to also pull the matching children and their siblings (check `matched_filter` to tell them apart). Ignored when `rootSpans: true`, which always returns just the root.\n\n## query.excludeAttributes\n\nSet `true` to drop the per-span `attributes` map from results (the map stays present but empty). The attribute map holds multi-KB values like `db.statement`, so excluding it keeps large result sets compact — set it when you only need span structure/timing (`name`, `service_name`, `duration_nano`, `parent_span_id`) and not the OTel attributes. Defaults to false.\n\n# Examples\n\n## List recent error spans\n\n```json\n{\n \"query\": {\n \"statusCodes\": [500, 503]\n }\n}\n```\n\n## Search spans from a specific service\n\n```json\n{\n \"query\": {\n \"serviceNames\": [\"api-gateway\"],\n \"dateRange\": { \"date_from\": \"-1d\" }\n }\n}\n```\n\n## Filter by a span attribute\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"http.method\", \"operator\": \"exact\", \"type\": \"span_attribute\", \"value\": \"POST\" }],\n \"dateRange\": { \"date_from\": \"-6h\" }\n }\n}\n```\n\n## Find slow spans\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"duration\", \"operator\": \"gt\", \"type\": \"span\", \"value\": \"1000000000\" }],\n \"dateRange\": { \"date_from\": \"-1d\" }\n }\n}\n```\n\n## Combine service and attribute filters\n\n```json\n{\n \"query\": {\n \"serviceNames\": [\"web-server\"],\n \"filterGroup\": [{ \"key\": \"http.status_code\", \"operator\": \"gt\", \"type\": \"span_attribute\", \"value\": \"399\" }],\n \"dateRange\": { \"date_from\": \"-12h\" }\n }\n}\n```\n\n## Check if a resource attribute exists\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"k8s.pod.name\", \"operator\": \"is_set\", \"type\": \"span_resource_attribute\" }]\n }\n}\n```\n\n# Reminders\n\n- Ensure that any property filters are directly relevant to the user's question. Avoid unnecessary filtering.\n- Use `apm-attributes-list` and `apm-attribute-values-list` to discover attributes before guessing filter keys/values.\n- Use `apm-services-list` to discover available services before filtering by service name.\n- Duration values are in nanoseconds (1 second = 1,000,000,000 nanoseconds).",
"category": "Tracing",
"feature": "tracing",
"summary": "Query tracing spans",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 6ef21229c85c..02a84e066602 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -492,7 +492,7 @@
"feature_flag": "tracing"
},
"apm-trace-get": {
- "description": "Fetch all spans for a specific trace by its hex trace ID. Returns the full span tree for the trace including parent-child relationships, timing, and status information. Use this to inspect a specific trace in detail after discovering it via the query tool.",
+ "description": "Fetch all spans for a specific trace by its hex trace ID. Returns the full span tree for the trace including parent-child relationships, timing, status information, and each span's attributes map. Use this to inspect a specific trace in detail after discovering it via the query tool. Set excludeAttributes to true to drop the per-span attributes map (which can hold multi-KB values like db.statement) and keep the payload compact.",
"category": "Tracing",
"feature": "tracing",
"summary": "Retrieve trace spans",
@@ -4508,7 +4508,7 @@
}
},
"query-apm-spans": {
- "description": "Query trace spans with filtering by service name, status code, date range, and structured attribute filters. Supports cursor-based pagination. Returns spans with uuid, trace_id, span_id, parent_span_id, name, kind, service_name, status_code, timestamp, end_time, duration_nano, is_root_span, matched_filter, and attributes (the span-level OTel attribute map, e.g. db.statement, http.url).\n\nUse 'apm-attributes-list' and 'apm-attribute-values-list' to discover available attributes before building filters. Use 'apm-services-list' to discover available services.\n\n# Return shape\n\nResults are **grouped by trace**, not a flat list of matching spans. For each trace that contains at least one span matching your filters, the response includes spans from that trace (up to `prefetchSpans` per trace, root span first). Two fields tell you which spans actually matched:\n\n- `matched_filter` — `1` if **this span** satisfies your `filterGroup`/`serviceNames`/`statusCodes`, `0` if it's only included because it shares a trace with a match (e.g. a prefetched sibling or the trace's root). When you filter by a child span's name, the matching child has `matched_filter: 1` and its root/siblings have `matched_filter: 0`.\n- `is_root_span` — `true` for the trace's entry span.\n\nTo collapse each matching trace to a **single row — its root span**, set `rootSpans: true` — see below. (The row is the trace's entry span, which may itself carry `matched_filter: 0` when the match was on a child.) To inspect a single trace's full tree, take a `trace_id` from the results and call `apm-trace-get`.\n\nCRITICAL: Be minimalist. Only include filters and settings that are essential to answer the user's specific question. Default settings are usually sufficient unless the user explicitly requests customization.\n\nAll parameters must be nested inside a `query` object.\n\n# Data narrowing\n\n## Property filters\n\nUse property filters via the `query.filterGroup` field to narrow results. Only include property filters when they are essential to directly answer the user's question.\n\nWhen using a property filter, you should:\n\n- **Choose the right type.** Span property types are:\n - `span` — filters built-in span fields (trace_id, span_id, duration, name, kind, status_code).\n - `span_attribute` — filters span-level attributes (e.g. \"http.method\", \"http.status_code\").\n - `span_resource_attribute` — filters resource-level attributes (e.g. k8s labels, deployment info).\n- **Use `apm-attributes-list` to discover available attribute keys** before building filters.\n- **Use `apm-attribute-values-list` to discover valid values** for a specific attribute key.\n- **Find the suitable operator for the value type** (see supported operators below).\n\nSupported operators:\n\n- String: `exact`, `is_not`, `icontains`, `not_icontains`, `regex`, `not_regex`\n- Numeric: `exact`, `gt`, `lt`\n- Existence (no value needed): `is_set`, `is_not_set`\n\nThe `value` field accepts a string, number, or array of strings depending on the operator. Omit `value` for `is_set`/`is_not_set`.\n\n## Time period\n\nUse the `query.dateRange` field to control the time window. If the question doesn't mention time, the default is the last hour (`-1h`). Examples of relative dates: `-1h`, `-6h`, `-1d`, `-7d`, `-30d`.\n\n# Parameters\n\nAll parameters go inside `query`.\n\n## query.serviceNames\n\nFilter by service names. Use `apm-services-list` to discover available services.\n\n## query.statusCodes\n\nFilter by HTTP status codes (list of integers).\n\n## query.orderBy\n\nSort by timestamp: `latest` (default) or `earliest`.\n\n## query.filterGroup\n\nA list of property filters to narrow results. Each filter specifies `key`, `operator`, `type` (span/span_attribute/span_resource_attribute), and optionally `value`. See the \"Property filters\" section above.\n\n## query.dateRange\n\nDate range to filter results. Defaults to the last hour (`-1h`).\n\n- `date_from`: Start of the range. Accepts ISO 8601 timestamps or relative formats: `-1h`, `-6h`, `-1d`, `-7d`, `-30d`.\n- `date_to`: End of the range. Same format. Omit or null for \"now\".\n\n## query.traceId\n\nFilter to a specific trace ID (hex string). Use this when you already know the trace ID.\n\n## query.rootSpans\n\nSet `true` to return **only root spans** — one entry span per matching trace, which collapses each trace to a single row. Useful for \"list the traces matching X\" without sifting through `matched_filter`. Leave unset (or `false`) to get all spans of matching traces, where you read `matched_filter` to find the ones that matched. The frontend leaves this unset.\n\n## query.limit\n\nMaximum number of results (1-1000). Defaults to 100.\n\n## query.after\n\nCursor for pagination. Use the `nextCursor` value from the previous response.\n\n## query.prefetchSpans\n\nNumber of spans to return per matching trace (1-100), root span first. Useful to preview trace structure without a separate `apm-trace-get`. With the default (1) you get one span per trace (the root); raise it to also pull the matching children and their siblings (check `matched_filter` to tell them apart). Ignored when `rootSpans: true`, which always returns just the root.\n\n# Examples\n\n## List recent error spans\n\n```json\n{\n \"query\": {\n \"statusCodes\": [500, 503]\n }\n}\n```\n\n## Search spans from a specific service\n\n```json\n{\n \"query\": {\n \"serviceNames\": [\"api-gateway\"],\n \"dateRange\": { \"date_from\": \"-1d\" }\n }\n}\n```\n\n## Filter by a span attribute\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"http.method\", \"operator\": \"exact\", \"type\": \"span_attribute\", \"value\": \"POST\" }],\n \"dateRange\": { \"date_from\": \"-6h\" }\n }\n}\n```\n\n## Find slow spans\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"duration\", \"operator\": \"gt\", \"type\": \"span\", \"value\": \"1000000000\" }],\n \"dateRange\": { \"date_from\": \"-1d\" }\n }\n}\n```\n\n## Combine service and attribute filters\n\n```json\n{\n \"query\": {\n \"serviceNames\": [\"web-server\"],\n \"filterGroup\": [{ \"key\": \"http.status_code\", \"operator\": \"gt\", \"type\": \"span_attribute\", \"value\": \"399\" }],\n \"dateRange\": { \"date_from\": \"-12h\" }\n }\n}\n```\n\n## Check if a resource attribute exists\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"k8s.pod.name\", \"operator\": \"is_set\", \"type\": \"span_resource_attribute\" }]\n }\n}\n```\n\n# Reminders\n\n- Ensure that any property filters are directly relevant to the user's question. Avoid unnecessary filtering.\n- Use `apm-attributes-list` and `apm-attribute-values-list` to discover attributes before guessing filter keys/values.\n- Use `apm-services-list` to discover available services before filtering by service name.\n- Duration values are in nanoseconds (1 second = 1,000,000,000 nanoseconds).",
+ "description": "Query trace spans with filtering by service name, status code, date range, and structured attribute filters. Supports cursor-based pagination. Returns spans with uuid, trace_id, span_id, parent_span_id, name, kind, service_name, status_code, timestamp, end_time, duration_nano, is_root_span, matched_filter, and attributes (the span-level OTel attribute map, e.g. db.statement, http.url).\n\nUse 'apm-attributes-list' and 'apm-attribute-values-list' to discover available attributes before building filters. Use 'apm-services-list' to discover available services.\n\n# Return shape\n\nResults are **grouped by trace**, not a flat list of matching spans. For each trace that contains at least one span matching your filters, the response includes spans from that trace (up to `prefetchSpans` per trace, root span first). Two fields tell you which spans actually matched:\n\n- `matched_filter` — `1` if **this span** satisfies your `filterGroup`/`serviceNames`/`statusCodes`, `0` if it's only included because it shares a trace with a match (e.g. a prefetched sibling or the trace's root). When you filter by a child span's name, the matching child has `matched_filter: 1` and its root/siblings have `matched_filter: 0`.\n- `is_root_span` — `true` for the trace's entry span.\n\nTo collapse each matching trace to a **single row — its root span**, set `rootSpans: true` — see below. (The row is the trace's entry span, which may itself carry `matched_filter: 0` when the match was on a child.) To inspect a single trace's full tree, take a `trace_id` from the results and call `apm-trace-get`.\n\nCRITICAL: Be minimalist. Only include filters and settings that are essential to answer the user's specific question. Default settings are usually sufficient unless the user explicitly requests customization.\n\nAll parameters must be nested inside a `query` object.\n\n# Data narrowing\n\n## Property filters\n\nUse property filters via the `query.filterGroup` field to narrow results. Only include property filters when they are essential to directly answer the user's question.\n\nWhen using a property filter, you should:\n\n- **Choose the right type.** Span property types are:\n - `span` — filters built-in span fields (trace_id, span_id, duration, name, kind, status_code).\n - `span_attribute` — filters span-level attributes (e.g. \"http.method\", \"http.status_code\").\n - `span_resource_attribute` — filters resource-level attributes (e.g. k8s labels, deployment info).\n- **Use `apm-attributes-list` to discover available attribute keys** before building filters.\n- **Use `apm-attribute-values-list` to discover valid values** for a specific attribute key.\n- **Find the suitable operator for the value type** (see supported operators below).\n\nSupported operators:\n\n- String: `exact`, `is_not`, `icontains`, `not_icontains`, `regex`, `not_regex`\n- Numeric: `exact`, `gt`, `lt`\n- Existence (no value needed): `is_set`, `is_not_set`\n\nThe `value` field accepts a string, number, or array of strings depending on the operator. Omit `value` for `is_set`/`is_not_set`.\n\n## Time period\n\nUse the `query.dateRange` field to control the time window. If the question doesn't mention time, the default is the last hour (`-1h`). Examples of relative dates: `-1h`, `-6h`, `-1d`, `-7d`, `-30d`.\n\n# Parameters\n\nAll parameters go inside `query`.\n\n## query.serviceNames\n\nFilter by service names. Use `apm-services-list` to discover available services.\n\n## query.statusCodes\n\nFilter by HTTP status codes (list of integers).\n\n## query.orderBy\n\nSort by timestamp: `latest` (default) or `earliest`.\n\n## query.filterGroup\n\nA list of property filters to narrow results. Each filter specifies `key`, `operator`, `type` (span/span_attribute/span_resource_attribute), and optionally `value`. See the \"Property filters\" section above.\n\n## query.dateRange\n\nDate range to filter results. Defaults to the last hour (`-1h`).\n\n- `date_from`: Start of the range. Accepts ISO 8601 timestamps or relative formats: `-1h`, `-6h`, `-1d`, `-7d`, `-30d`.\n- `date_to`: End of the range. Same format. Omit or null for \"now\".\n\n## query.traceId\n\nFilter to a specific trace ID (hex string). Use this when you already know the trace ID.\n\n## query.rootSpans\n\nSet `true` to return **only root spans** — one entry span per matching trace, which collapses each trace to a single row. Useful for \"list the traces matching X\" without sifting through `matched_filter`. Leave unset (or `false`) to get all spans of matching traces, where you read `matched_filter` to find the ones that matched. The frontend leaves this unset.\n\n## query.limit\n\nMaximum number of results (1-1000). Defaults to 100.\n\n## query.after\n\nCursor for pagination. Use the `nextCursor` value from the previous response.\n\n## query.prefetchSpans\n\nNumber of spans to return per matching trace (1-100), root span first. Useful to preview trace structure without a separate `apm-trace-get`. With the default (1) you get one span per trace (the root); raise it to also pull the matching children and their siblings (check `matched_filter` to tell them apart). Ignored when `rootSpans: true`, which always returns just the root.\n\n## query.excludeAttributes\n\nSet `true` to drop the per-span `attributes` map from results (the map stays present but empty). The attribute map holds multi-KB values like `db.statement`, so excluding it keeps large result sets compact — set it when you only need span structure/timing (`name`, `service_name`, `duration_nano`, `parent_span_id`) and not the OTel attributes. Defaults to false.\n\n# Examples\n\n## List recent error spans\n\n```json\n{\n \"query\": {\n \"statusCodes\": [500, 503]\n }\n}\n```\n\n## Search spans from a specific service\n\n```json\n{\n \"query\": {\n \"serviceNames\": [\"api-gateway\"],\n \"dateRange\": { \"date_from\": \"-1d\" }\n }\n}\n```\n\n## Filter by a span attribute\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"http.method\", \"operator\": \"exact\", \"type\": \"span_attribute\", \"value\": \"POST\" }],\n \"dateRange\": { \"date_from\": \"-6h\" }\n }\n}\n```\n\n## Find slow spans\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"duration\", \"operator\": \"gt\", \"type\": \"span\", \"value\": \"1000000000\" }],\n \"dateRange\": { \"date_from\": \"-1d\" }\n }\n}\n```\n\n## Combine service and attribute filters\n\n```json\n{\n \"query\": {\n \"serviceNames\": [\"web-server\"],\n \"filterGroup\": [{ \"key\": \"http.status_code\", \"operator\": \"gt\", \"type\": \"span_attribute\", \"value\": \"399\" }],\n \"dateRange\": { \"date_from\": \"-12h\" }\n }\n}\n```\n\n## Check if a resource attribute exists\n\n```json\n{\n \"query\": {\n \"filterGroup\": [{ \"key\": \"k8s.pod.name\", \"operator\": \"is_set\", \"type\": \"span_resource_attribute\" }]\n }\n}\n```\n\n# Reminders\n\n- Ensure that any property filters are directly relevant to the user's question. Avoid unnecessary filtering.\n- Use `apm-attributes-list` and `apm-attribute-values-list` to discover attributes before guessing filter keys/values.\n- Use `apm-services-list` to discover available services before filtering by service name.\n- Duration values are in nanoseconds (1 second = 1,000,000,000 nanoseconds).",
"category": "Tracing",
"feature": "tracing",
"summary": "Query tracing spans",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 0944685360e0..9c3f14c5550f 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -19688,6 +19688,8 @@ export namespace Schemas {
/** Cursor for fetching the next page of results */
after?: string | null;
dateRange: DateRange;
+ /** Omit the per-span `attributes` map from results to keep payloads compact */
+ excludeAttributes?: boolean | null;
filterGroup?: PropertyGroupFilter | null;
kind?: 'TraceSpansQuery';
limit?: number | null;
@@ -40452,6 +40454,8 @@ export namespace Schemas {
rootSpans?: boolean;
/** Number of child spans to prefetch per trace (1-100). */
prefetchSpans?: number;
+ /** Omit the per-span attributes map from results to keep payloads compact. Defaults to false. */
+ excludeAttributes?: boolean;
}
export interface _TracingQueryRequest {
@@ -40462,6 +40466,8 @@ export namespace Schemas {
export interface _TracingTraceRequest {
/** Date range for the query. Defaults to last 24 hours. */
dateRange?: _TracingDateRange;
+ /** Omit the per-span attributes map from results to keep payloads compact. Defaults to false. */
+ excludeAttributes?: boolean;
}
export interface _TracingTreeQueryBody {
diff --git a/services/mcp/src/generated/tracing/api.ts b/services/mcp/src/generated/tracing/api.ts
index 73a0382d359f..7a038575182b 100644
--- a/services/mcp/src/generated/tracing/api.ts
+++ b/services/mcp/src/generated/tracing/api.ts
@@ -150,6 +150,7 @@ export const TracingSpansQueryCreateParams = /* @__PURE__ */ zod.object({
export const tracingSpansQueryCreateBodyQueryOneFilterGroupDefault = []
export const tracingSpansQueryCreateBodyQueryOneLimitDefault = 100
export const tracingSpansQueryCreateBodyQueryOneRootSpansDefault = true
+export const tracingSpansQueryCreateBodyQueryOneExcludeAttributesDefault = false
export const TracingSpansQueryCreateBody = /* @__PURE__ */ zod.object({
query: zod
@@ -234,6 +235,10 @@ export const TracingSpansQueryCreateBody = /* @__PURE__ */ zod.object({
.default(tracingSpansQueryCreateBodyQueryOneRootSpansDefault)
.describe('Filter to root spans only. Defaults to true.'),
prefetchSpans: zod.number().optional().describe('Number of child spans to prefetch per trace (1-100).'),
+ excludeAttributes: zod
+ .boolean()
+ .default(tracingSpansQueryCreateBodyQueryOneExcludeAttributesDefault)
+ .describe('Omit the per-span attributes map from results to keep payloads compact. Defaults to false.'),
})
.describe('The tracing spans query to execute.'),
})
@@ -262,6 +267,8 @@ export const TracingSpansTraceCreateParams = /* @__PURE__ */ zod.object({
trace_id: zod.string().regex(tracingSpansTraceCreatePathTraceIdRegExp),
})
+export const tracingSpansTraceCreateBodyExcludeAttributesDefault = false
+
export const TracingSpansTraceCreateBody = /* @__PURE__ */ zod.object({
dateRange: zod
.object({
@@ -278,6 +285,10 @@ export const TracingSpansTraceCreateBody = /* @__PURE__ */ zod.object({
})
.optional()
.describe('Date range for the query. Defaults to last 24 hours.'),
+ excludeAttributes: zod
+ .boolean()
+ .default(tracingSpansTraceCreateBodyExcludeAttributesDefault)
+ .describe('Omit the per-span attributes map from results to keep payloads compact. Defaults to false.'),
})
export const TracingSpansTreeCreateParams = /* @__PURE__ */ zod.object({
diff --git a/services/mcp/src/tools/generated/tracing.ts b/services/mcp/src/tools/generated/tracing.ts
index 9b3f973b53ec..5b21e732f190 100644
--- a/services/mcp/src/tools/generated/tracing.ts
+++ b/services/mcp/src/tools/generated/tracing.ts
@@ -136,6 +136,9 @@ const apmTraceGet = (): ToolBase<typeof ApmTraceGetSchema, unknown> =>
if (params.dateRange !== undefined) {
body['dateRange'] = params.dateRange
}
+ if (params.excludeAttributes !== undefined) {
+ body['excludeAttributes'] = params.excludeAttributes
+ }
const result = await context.api.request<unknown>({
method: 'POST',
path: `/api/projects/${encodeURIComponent(String(projectId))}/tracing/spans/trace/${encodeURIComponent(String(params.trace_id))}/`,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/apm-trace-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/apm-trace-get.json
index 1e44cd2bce7d..49d4841eac31 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/apm-trace-get.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/apm-trace-get.json
@@ -29,6 +29,11 @@
},
"type": "object"
},
+ "excludeAttributes": {
+ "default": false,
+ "description": "Omit the per-span attributes map from results to keep payloads compact. Defaults to false.",
+ "type": "boolean"
+ },
"trace_id": {
"pattern": "^[a-zA-Z0-9]+$",
"type": "string"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-apm-spans.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-apm-spans.json
index 5e87b0940078..f7b6b35f7856 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-apm-spans.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-apm-spans.json
@@ -36,6 +36,11 @@
},
"type": "object"
},
+ "excludeAttributes": {
+ "default": false,
+ "description": "Omit the per-span attributes map from results to keep payloads compact. Defaults to false.",
+ "type": "boolean"
+ },
"filterGroup": {
"default": [],
"description": "Property filters for the query.",