Skip to main content
Glama

Read a trace table

trace_query
Read-only

Pages through rows or time windows of a GPU trace table, filtering, ordering, grouping and aggregating them to inspect per-process frame pacing, durations and counts.

Instructions

Returns one page of rows of one table of a recording as {column: value}, optionally one process's. With window_ms the page holds time windows instead ({start_ms, count}, plus duration_ms when the table has a duration column). Rows come from the .trace when kept, else from the tables file; where, columns, order_by with descending, and group_by with aggregates filter and summarize the tables file (never SQL) and need it.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "trace": "<trace>",
      "schema": "<schema>"
    },
    "name": "trace_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
pidNokeep only this process's rows
limitNodefault 50, at most 500
traceYesa run name from perf_runs with trace_kept or tables_kept true, or a .trace path
whereNotables file only, joined by AND: {column, op, value}, op one of = != < <= > >=; a time or size column holds its number as text: compare with a number
fieldsNoresult paths to keep, dotted: common.frame_pacing
offsetNodefault 0
schemaYesa table name that trace_tables lists, such as metal-gpu-intervals
columnsNotables file only: keep these columns
group_byNotables file only: group rows by these columns (each group gets its count)
order_byNotables file only: a column, or with group_by an aggregate name such as count or sum_duration
window_msNo1 to 3600000: time windows of this many ms instead of rows (needs a start or time column)
aggregatesNotables file only: {fn, column}, fn count, sum, avg, min or max; named fn_column
descendingNowith order_by, largest first

Output Schema

NameRequiredDescriptionDefault
rowsYes
totalYes
offsetYes
next_offsetYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changedv0.28.0
    • addedInput schema / properties / aggregates
      Added value: +{
      +  "description": "tables file only: {fn, column}, fn count, sum, avg, min or max; named fn_column",
      +  "items": {
      +    "properties": {
      +      "column": {
      +        "type": "string"
      +      },
      +      "fn": {
      +        "enum": [
      +          "count",
      +          "sum",
      +          "avg",
      +          "min",
      +          "max"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "fn"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / columns
      Added value: +{
      +  "description": "tables file only: keep these columns",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / descending
      Added value: +{
      +  "description": "with order_by, largest first",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / fields
      Added value: +{
      +  "description": "result paths to keep, dotted: common.frame_pacing",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / group_by
      Added value: +{
      +  "description": "tables file only: group rows by these columns (each group gets its count)",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedInput schema / properties / limit / description
      Previous value: -"rows per page, default 50, at most 500"New value: +"default 50, at most 500"
    • changedInput schema / properties / offset / description
      Previous value: -"first row, default 0"New value: +"default 0"
    • addedInput schema / properties / order_by
      Added value: +{
      +  "description": "tables file only: a column, or with group_by an aggregate name such as count or sum_duration",
      +  "type": "string"
      +}
    • changedInput schema / properties / trace / description
      Previous value: -"a run name from perf_runs whose trace_kept is true, or the path of a .trace"New value: +"a run name from perf_runs with trace_kept or tables_kept true, or a .trace path"
    • addedInput schema / properties / where
      Added value: +{
      +  "description": "tables file only, joined by AND: {column, op, value}, op one of = != < <= > >=; a time or size column holds its number as text: compare with a number",
      +  "items": {
      +    "properties": {
      +      "column": {
      +        "type": "string"
      +      },
      +      "op": {
      +        "enum": [
      +          "=",
      +          "!=",
      +          "<",
      +          "<=",
      +          ">",
      +          ">="
      +        ],
      +        "type": "string"
      +      },
      +      "value": {
      +        "type": [
      +          "string",
      +          "number",
      +          "null"
      +        ]
      +      }
      +    },
      +    "required": [
      +      "column",
      +      "op",
      +      "value"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • changedInput schema / properties / window_ms / description
      Previous value: -"1 to 3600000: return time windows of this many ms, each with its count and summed duration, instead of rows (the table needs a start or time column)"New value: +"1 to 3600000: time windows of this many ms instead of rows (needs a start or time column)"
  2. Changed1 schema field changedv0.27.0
    • addedInput schema / properties / window_ms
      Added value: +{
      +  "description": "1 to 3600000: return time windows of this many ms, each with its count and summed duration, instead of rows (the table needs a start or time column)",
      +  "type": "integer"
      +}
  3. Changed1 schema field changedv0.10.1
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "next_offset": {
      +      "type": [
      +        "integer",
      +        "null"
      +      ]
      +    },
      +    "offset": {
      +      "type": "integer"
      +    },
      +    "rows": {
      +      "type": "array"
      +    },
      +    "total": {
      +      "type": "integer"
      +    }
      +  },
      +  "required": [
      +    "total",
      +    "offset",
      +    "rows",
      +    "next_offset"
      +  ],
      +  "type": "object"
      +}
  4. Changed3 schema fields changedv0.7.1
    • addedInput schema / properties / pid / description
      Added value: +"keep only this process's rows"
    • addedInput schema / properties / schema / description
      Added value: +"a table name that trace_tables lists, such as metal-gpu-intervals"
    • addedInput schema / properties / trace / description
      Added value: +"a run name from perf_runs whose trace_kept is true, or the path of a .trace"
  5. First observedv0.2.0

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare this a read-only, non-open-world operation, so the description's contribution is data-source behavior: rows come from the .trace when kept, otherwise from the tables file, and filters/sorts/group-bys are applied to the tables file 'never SQL'. That is genuinely useful context an agent could not infer, and it prevents wrong assumptions about query semantics. It does not cover cost or performance characteristics of scanning large tables.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

It is short and front-loads the core return shape, with no filler sentences. However, the middle clause packs filter/sort/group behavior into a comma-spliced run-on that requires rereading, which slightly undercuts the otherwise tight structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter tool over a rich schema, the description covers the essentials: what a page is, the two page modes, source resolution, and which parameters are restricted to the tables file. With an output schema present, it need not detail return values, and it does not need to. Only the omission of guidance toward sibling tools (counting, listing tables) is a gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema documents each of the 13 parameters, and the description does not merely repeat them. It adds the interaction semantics: window_ms changes the page to {start_ms, count} plus duration_ms when a duration column exists, group_by yields per-group counts, and order_by accepts an aggregate name only when group_by is present. That is meaningfully more than the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first clause gives a specific verb, resource, and scope: a page of rows from one table of a recording, plus the row shape {column: value}. It also declares the alternate windowed mode, so the agent knows the output shape changes. It stops short of naming a sibling to distinguish itself from, but the read-a-table purpose is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It states a real precondition: where, columns, order_by, and group_by only work against the tables file and 'need it', which warns an agent away from using them on .trace-backed runs. It gives no when-to-use-this-vs-alternatives guidance (e.g. trace_count for totals, trace_tables for discovery) beyond a passing mention that schema names come from trace_tables. Usage context is implied rather than spelled out.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.