Skip to main content
Glama

factiq

Run SQL query

run_sql

Run a read-only SELECT against the FactIQ data warehouse, scoped to one schema — the power tool for joins, pivots and aggregation.

Read-only role, 30s statement timeout, with FactIQ's query transforms and series-metadata enrichment. Resolve ids from series before filtering data_points. auto_retry=true opts into a server-side reviser on zero rows. See the factiq://guide/sql resource.

Returns at most 50 rows. If the query matches more, the result is flagged "truncated": true — that is your cue to aggregate or compute in SQL (GROUP BY, date_trunc, a SUM/AVG/rank/ratio) and return that, NOT to try to fetch the raw rows. A chart or a summary needs the aggregated result, and large raw results don't fit in context anyway.

Year-over-year and other period comparisons must join on the calendar period (date_trunc('month', prior.time) = date_trunc('month', cur.time) - interval '1 year' — the stored day of the month varies by source, so never compare exact dates), never on a row offset such as LAG(value, 12) OVER (ORDER BY time): a series with one missing month compares the wrong periods for the twelve rows after the gap (LEAD: the twelve before it) and the numbers still look plausible. For one series prefer get_series with transform. When the result carries a coverage_note, the rows have periods with no observation (listed in missing_periods, per series): name them in the answer, do not interpolate, and label any aggregate that spans them as partial.

page is the one exception and works only on the nasa_fires schema, where a row is a single fire detection that belongs to no series and so cannot be aggregated into one. Each page holds 50 rows; the answer carries page and has_more, and you read the next block with page=2, page=3 and so on. Give the query an ORDER BY, otherwise Postgres may return the same row on two pages and never return another. Still prefer a count or a total when that answers the question — paging through thousands of detections does not.

Runs through FactIQ's read-only database role, which rejects any attempt to modify data (INSERT/UPDATE/DELETE/DROP/…).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
pageNo
schemaYes
exploreNo
questionNo
auto_retryNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior1/5

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

The description states the tool is strictly read-only ('Run a read-only SELECT', 'runs through FactIQ's read-only database role, which rejects any attempt to modify data'), but the annotations declare readOnlyHint=false, which asserts the tool is not read-only. This is a direct conflict on a safety-critical property and is exactly the kind of mismatch an agent could act on. Despite otherwise rich disclosure (30s timeout, 50-row cap, truncation flag, coverage_note semantics), the rule for a contradiction applies.

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?

Dense but front-loaded: capability, limits, and output semantics come before the paging exception. Nearly every sentence carries operative detail (limits, join syntax, ordering requirement), though the paging discussion runs long relative to its narrow scope and could be tightened.

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?

An output schema exists, yet the description still usefully explains the `truncated`, `coverage_note`, `missing_periods`, `page` and `has_more` return semantics an agent must reason about. Combined with the timeout and read-only role disclosure, it is close to complete for a complex query tool; only the `explore` and `question` parameters are left unexplained.

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 description coverage is 0%, so the description must carry parameter meaning, and it does for four of six: `sql` as SELECT-only, `schema` as single-schema scoping, `page` restricted to `nasa_fires` with 50 rows per page and an ORDER BY requirement, and `auto_retry` as a server-side reviser on zero rows. `explore` and `question` are never explained, which is the remaining gap.

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?

States a specific verb and resource ('Run a read-only SELECT against the FactIQ data warehouse, scoped to one schema') plus the capability envelope ('joins, pivots and aggregation'). It distinguishes itself from siblings by explicitly routing single-series work to `get_series` and by naming the one schema (`nasa_fires`) where paging applies.

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?

Gives explicit when-to-use rules and when-not rules: prefer aggregation over fetching raw rows when `truncated` is set, prefer `get_series` with `transform` for a single series, and use `page` only on `nasa_fires`. It even supplies the correct join pattern for YoY comparisons and forbids the tempting `LAG` alternative with the reason why.

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