Skip to main content
Glama

gulliver_fix

Read-onlyIdempotent

Rewrites SQL to prune partitions and cut big-data cost, labels each change as row-equivalent or result-changing, and optionally verifies changes on generated edge-case data in an in-memory DuckDB.

Instructions

Rewrite SQL so it is cheaper on big data (e.g. DATE(ts) = '...' becomes a range on ts so partitions are pruned) and say per change whether the rows stay exactly the same. With a connection it estimates before vs after (no data read). mode='all' adds rewrites that change the result on purpose (LIMIT, approx count, UNION ALL, NOT EXISTS). verify=true tests each change on generated edge-case data in a private in-memory DuckDB (your data is never read for this). Use it after gulliver_lint finds problems; it only returns SQL and never runs it on the connection.

Input Schema

NameRequiredDescriptionDefault
sqlYesExactly one SQL statement (SELECT/WITH) in the connection's dialect. Several statements are rejected.
modeNosafe: only rewrites that keep exactly the same rows. all: also result-changing rewrites.safe
seedNoRandom seed for verify. The same seed gives the same cases, so a counterexample can be reproduced.
casesNoHow many edge-case datasets verify generates (default 200). More cases find rarer differences but take longer.
limitNoRow limit to add in mode 'all' when the result is unbounded.
verifyNoAlso test every change on generated edge-case data (NULLs, duplicates, date boundaries, time zones) in a private in-memory DuckDB, and return a small counterexample when rows differ. A test, not a proof: labels never change because of it.
dialectNoSQL dialect. Omit to use the connection's dialect.
timezoneNoSession time zone for verify, e.g. 'Europe/Amsterdam'. Omit to try several.
connectionNoConnection name as listed by gulliver_status (from gulliver.toml or GULLIVER_DSN). Omit for the default connection.

Output Schema

NameRequiredDescriptionDefault
statusYes
next_stepYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.3.1
    • changedInput schema / properties / cases / description
      Previous value: -"Generated cases for verify (default 200)."New value: +"How many edge-case datasets verify generates (default 200). More cases find rarer differences but take longer."
    • changedInput schema / properties / connection / description
      Previous value: -"Connection name from gulliver_status. Omit for the default."New value: +"Connection name as listed by gulliver_status (from gulliver.toml or GULLIVER_DSN). Omit for the default connection."
    • changedInput schema / properties / seed / description
      Previous value: -"Seed for verify; the same seed gives the same cases."New value: +"Random seed for verify. The same seed gives the same cases, so a counterexample can be reproduced."
    • changedInput schema / properties / sql / description
      Previous value: -"One SQL statement in the connection's dialect."New value: +"Exactly one SQL statement (SELECT/WITH) in the connection's dialect. Several statements are rejected."
  2. Addedv0.1.1

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations, the description discloses the key behavioral facts: with a connection it estimates before/after cost without reading data, verify runs in a private in-memory DuckDB that never touches the user's data, mode='all' deliberately changes results, and the tool never executes anything against the connection. These claims are fully consistent with readOnlyHint=true, destructiveHint=false and idempotentHint=true.

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?

The purpose is front-loaded in the first clause, and every sentence carries new information (cost estimation, mode='all', verify, when to use). The dense run of parentheticals makes it slightly harder to scan than an ideal definition, but there is no filler.

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 9-parameter tool with an output schema, the description covers all the decision-relevant aspects: what it produces (SQL only), what it does not do (no execution, no data read), the risk profile of mode='all', and how verification works. The return-value shape is left to the output schema, which is appropriate.

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 a 3, and the description meaningfully adds to it by explaining that mode='all' introduces result-changing rewrites (LIMIT, approx count, UNION ALL, NOT EXISTS), what verify=true actually does, and that supplying a connection enables cost estimation. It does not touch seed/cases/timezone/dialect semantics beyond what the schema already states.

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 description names a specific verb (rewrite SQL), the optimization goal (cheaper on big data / partition pruning) and gives a concrete before/after example (DATE(ts) = '...' becomes a range). It also distinguishes itself from siblings by naming gulliver_lint as the upstream diagnostics tool and by stating it 'only returns SQL and never runs it on the connection', which separates it from execution tools like gulliver_run.

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

Usage Guidelines4/5

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

It gives a clear trigger ('use after gulliver_lint finds results') and clarifies an important scope limit: the tool never executes the SQL. What is missing is an explicit when-not condition or a pointer to the next step in the workflow (e.g. gulliver_preflight/gulliver_rehearse/gulliver_run) for actually validating or executing the rewritten query.

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