Skip to main content
Glama

ctxQueryTraces

Read-only

Query approval, enrichment, recipe-run, decision, and gate decision trails by trace type, time window, key, tag, or free-text search to explain why an event happened across sources.

Instructions

Unified query over approval / enrichment / recipe-run trails. Filter by traceType, time window, or natural key. Answers 'why did X happen' across sources.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qNoCase-insensitive substring search across the trace summary and serialized body. Use for free-form lookup when the key schema doesn't fit.
keyNoExact key match (sessionId:toolName / sha:ref / taskId). Substring match on the key; case-sensitive.
tagNoRestrict to decision traces carrying this tag (exact match, case-sensitive). Other trace types don't have tags and will be excluded when this filter is set.
limitNoMax results after filtering. Default 100.
sinceNoOnly return traces with ts > this ms-epoch value.
semanticNoWhen true AND an embeddings endpoint is configured AND q is set, rank results by on-device semantic similarity instead of recency. Falls back to substring match when embeddings are unavailable.
traceTypeNoOptional filter — restrict to one source. Omit to get all. `gate_decision` = worker-autonomy gate decisions + their inputs.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.2.3
    • addedInput schema / properties / semantic
      Added value: +{
      +  "description": "When true AND an embeddings endpoint is configured AND q is set, rank results by on-device semantic similarity instead of recency. Falls back to substring match when embeddings are unavailable.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / traceType / description
      Previous value: -"Optional filter — restrict to one source. Omit to get all."New value: +"Optional filter — restrict to one source. Omit to get all. `gate_decision` = worker-autonomy gate decisions + their inputs."
    • changedInput schema / properties / traceType / enum
      Previous value: -[
      -  "approval",
      -  "enrichment",
      -  "recipe_run",
      -  "decision"
      -]New value: +[
      +  "approval",
      +  "enrichment",
      +  "recipe_run",
      +  "decision",
      +  "gate_decision"
      +]
  2. First observedv1.0.0

TDQS

B3.4/5.0
Behavior3/5

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

readOnlyHint=true already tells the agent this is a safe read. The description adds the useful cross-source scope and the decision-record purpose, but says nothing about result volume, ordering (only the semantic param hints at ranking), or how the different trace types interleave in the output.

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

Conciseness4/5

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

Two tight sentences with the resource scope front-loaded and the intent statement second. No filler, though the 'natural key' phrase is a slightly opaque shorthand for the key parameter.

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

Completeness3/5

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

For a 7-parameter, all-optional query tool with no output schema, the description covers the domain adequately but omits what a returned trace looks like and how the five trace types differ in shape. Adequate but with clear gaps given the breadth of the tool.

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

Parameters3/5

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

Schema coverage is 100%, so every parameter including q, key, semantic, and traceType is already documented in the schema. The description only loosely mentions 'traceType, time window, or natural key', which maps to but adds nothing beyond the schema. Baseline 3 is correct when the schema does the heavy lifting.

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?

States a specific verb (query) and resource (approval/enrichment/recipe-run trails) with the added abstract framing of answering 'why did X happen'. An agent can distinguish this read-only trace query from ctxSaveTrace, its write counterpart. Slightly held back by jargon ('trails') and lack of explicit naming of the nearest sibling.

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?

The 'why did X happen' framing implies a debugging/audit use case, and the filters are enumerated. However there is no when-not guidance, no statement of prerequisites, and no explicit routing to or away from alternatives like getCommitDetails or ctxGetTaskContext.

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

Deploy Server

Other Tools