Skip to main content
Glama

run_saved_query

Read-only

Re-run a saved request's queries against live data — exactly, or re-aimed at other entities with typed values. No planning, no polling.

The payoff of `save_user_query`: pass a saved row's `queries` array from
`list_saved_queries` and each stored query runs as-is, returning fresh rows
synchronously. Use this INSTEAD of `explore_data_catalogue` whenever a saved row
already covers the question — same SQL, current data, seconds instead of minutes,
and it does not draw on the 20/hour exploration budget.

A full signed URL is accepted in `query_tokens` and unwrapped. For a token
that came from a `get_company_event_web` node rather than a saved row, use
`get_signed_sql_drilldown` — same endpoint, single node, drilldown framing.

`values` slots are substituted deterministically, with no language model in the
loop (~0.5-1.2 s per query). Reach for it whenever you already know the entities —
you usually do, having resolved the tickers or CIKs before calling — and keep
`prompt` for what you cannot type.
  - Entity-set slots (type `cik_rows` / `symbol_rows`) take a LIST of {"id",
    "name"} objects: [{"id": "0001454027", "name": "Verition Fund Management LLC"}].
    A name-only entry ({"id": "", "name": "Walleye Capital"}) is resolved
    server-side against the filer registry; a name it cannot resolve comes back as
    a 422, never as a guess.
  - Pass the SAME dict to every token of a row: each twin picks out the slots it
    uses, and keys no twin uses come back as `ignored_values`.
  - A slot left out falls back to `prompt`, and then to the value the row was
    saved with (reported as `defaulted_parameters`).

`prompt`: a plain `queries` token has no slots and replays unchanged. The backend
maps the wording onto the row's typed slots. A 422 means it could not — fall back
to `explore_data_catalogue` for that question. A prompt-only fill can also DRIFT (a
slot the wording never mentions, a date say, can come back re-aimed), which is the
second reason to prefer `values`: never infer the substituted values from the
wording, read them out of `parameters` and say them back to the user.

`max_rows`: uncapped, a saved row's
`_constituents` companion query returns 7,000-35,000 rows (3-8 MB) and the client
stalls for minutes. A sliced result carries `row_count` (the full count) and
`truncated: true`; say the user is seeing a slice of N rows.

Returns {"queries_run": N, "results": [{"index": i, "format": "table",
"count": <rows returned>, "rows": [...], ...}, ...]}, in the SAME ORDER as
`query_tokens`. A re-aimed replay adds, per result:
  `parameters`            the values actually substituted (resolved ids and
                          canonical names)
  `defaulted_parameters`  slots that kept the saved example ("prior quarter kept
                          as 2026-03-31")
  `ignored_values`        keys in `values` this twin does not use
Surface all three: which values were substituted, which kept the saved example,
which were ignored. Rows only — the underlying SQL is never returned, by design.
Describe the results from the row's `metadata.summary`, the substituted
parameters, and the columns, never by asserting what the query does internally.

CITE WHAT YOU PUBLISH: each entry in `results` may carry `_source_*` columns —
`_source_url`, `_source_filed_at`, `_source_document_id`, `_source_citations` —
alongside a `sources` block naming each relation, its grain, and whether it is
`traceable` per "row" or only as a "cohort". That is the provenance of the numbers,
not padding: quote `_source_url` when the user asks where a figure came from, and for anything
you are about to publish — or the moment they ask for the filing, the quote, or
"how do you know" — pass `sources.relations[].relation` plus each row's
identifying columns (the grain AND its date) to `trace_data_sources`, which
resolves them to the source document, the
section, or the verified quote behind the number. `get_document_section` then opens
the exact speaker turn a transcript citation points at.

Each token runs independently: one failure does not stop the rest, and that entry
carries an "error" key instead of rows. A 403 means that token is invalid or
tampered — do not retry it altered; the saved row is dead, so re-run
`explore_data_catalogue`, `save_user_query` a fresh row, and `delete_saved_query`
the old one. A 422 on a re-aimed replay is the mapping failure above (unknown
entity, wrong shape), not a dead row.

A replay returning DIFFERENT rows than when it was saved is normal — it hits live
data. Report what comes back now; never reconcile it against remembered numbers.

Requires auth (your MCP client attaches the OAuth bearer automatically).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptNoNatural-language fill for slots `values` did not cover, e.g. "the past 8 quarters of sales for KSS". Placeholder tokens only.
valuesNoPREFERRED way to re-aim: {slot name: typed value}, keys from the row's `metadata.parameters`, e.g. {"symbol": "KSS"}. Entity-set slots take [{"id", "name"}] lists. Pass the same dict for every token.
max_rowsNoRow cap per query, e.g. 500 — PASS IT ON EVERY REPLAY.
query_tokensYesA saved row's `queries` list (exact replay) or its `query_placeholder` list (re-aiming with values/prompt), verbatim. Max 25. Never construct or edit a token.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultsYesOne entry per query token, in the same order.
queries_runYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior3/5

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

Annotations only declare readOnlyHint=true, and the description goes well beyond that: no planning/polling, exempt from the 20/hour exploration budget, per-token isolation (one failure doesn't stop others), 403 = dead row vs 422 = mapping failure, truncation via row_count/truncated, and prompt-only fills can DRIFT. It also states SQL is never returned and provenance columns may appear. This is unusually rich behavioral disclosure. However, much of it is arguably operational instruction for the caller rather than intrinsic tool behavior, and return-shape detail overlaps the existing output schema.

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?

Front-loaded with the core purpose before any elaboration, and each subsequent paragraph covers a distinct concern (tokens/values, prompt, max_rows, return shape, provenance, error handling). It is long and dense, and the return-shape and provenance passages drift into guidance that could be trimmed, but almost every sentence carries actionable information.

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

Completeness5/5

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

For a 4-param tool with an output schema, no behavioral or routing gap remains: the exact-vs-re-aimed distinction, fallback chain, error taxonomy, truncation signaling, staleness expectation, and downstream trace_data_sources handoff are all covered. An agent could call this correctly on the first attempt from the description alone.

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 baseline is 3, but the description adds real semantics beyond the schema: the same `values` dict must be passed to every token, entity-set slots take {"id","name"} lists with server-side name resolution, unused keys surface as `ignored_values`, and slots fall back to `prompt` then the saved default (`defaulted_parameters`). `max_rows` guidance ("PASS IT ON EVERY REPLAY") is also operational context the schema lacks.

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

Purpose5/5

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

Opens with a specific verb+resource ("Re-run a saved request's queries against live data") and immediately distinguishes exact replay from re-aimed replay. It names the sibling producing the input (list_saved_queries), the one it complements (save_user_query), and the ones it competes with (explore_data_catalogue, get_signed_sql_drilldown).

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

Usage Guidelines5/5

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

Explicit routing: "Use this INSTEAD of explore_data_catalogue whenever a saved row already covers the question," and "For a token that came from a get_company_event_web node ... use get_signed_sql_drilldown." It also states when to prefer `values` over `prompt` ("keep prompt for what you cannot type") and gives explicit fallback paths on 422/403.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources