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 situate 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).

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": {
      "query_tokens": "<query_tokens>"
    },
    "name": "run_saved_query"
  }
}

Input 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

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.9/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true; the description carries the rest and does so thoroughly — synchronous execution at ~0.5-1.2 s per query, budget exemption, the 3-8 MB / 7,000-35,000-row stall risk and `truncated` semantics, per-token isolation with an `error` key, the 403-dead-row vs. 422-mapping-failure distinction, drift on prompt-only fills, and the expectation that live data will differ from saved results. Nothing here contradicts readOnlyHint.

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?

Well front-loaded — purpose and the key routing decision come in the first two paragraphs, with implementation details and error handling below. It is long for a 4-parameter tool, and the 'CITE WHAT YOU PUBLISH' block plus the `_source_*` column inventory sit closer to downstream citation policy than to how to invoke this tool, so a trim is defensible. Still, nearly every sentence carries callable information rather than repeating the schema.

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?

Despite an output schema existing, the description still spells out the exact return envelope and result ordering ('SAME ORDER as `query_tokens`'), which is ordering information a schema alone rarely conveys. Combined with error handling, provenance columns, and the values/prompt/default cascade, an agent has everything needed to call this correctly and to interpret the response without guessing.

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

Parameters5/5

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

Schema coverage is 100%, so the baseline would be 3, but the description goes well beyond it: it explains the entity-set slot shape with a concrete {'id','name'} example, name-only resolution with a 422 rather than a guess, the rule to pass the SAME dict to every token and the resulting `ignored_values`, and the three-tier fallback order (values → prompt → saved default reported as `defaulted_parameters`). It also gives the operational justification for `max_rows` that the schema only asserts ('PASS IT ON EVERY REPLAY').

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?

The opening line states a precise verb and resource — re-run a saved request's queries against live data — and immediately distinguishes two modes (exact replay vs. re-aimed with typed `values`). It also names what it is not: exploration (`explore_data_catalogue`), drilldown on a web-node token (`get_signed_sql_drilldown`), and the save/list siblings. An agent can pick it out of a 30-tool catalog without opening the schema.

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', with reasons (same SQL, seconds not minutes, exempt from the 20/hour budget). It names the alternative for the adjacent case ('For a token that came from a situate web node... use `get_signed_sql_drilldown`'), the fallback on 422, the recovery path on 403 (explore → save → delete), and when to use `prompt` instead of `values`. Almost nothing is left to inference.

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