Skip to main content
Glama

gulliver_rehearse

Read-only

Runs a SQL query on small samples to measure runtime, rows, and bytes, then predicts full-run cost with a confidence range. Use it when joins or skew make estimates unreliable.

Instructions

Run the query on small samples (default 1%, 3%, 10% of the largest table), measure runtime/rows/bytes and predict the full run with a confidence range. Costs a fraction of the full run (budget-checked first). Never writes data. Use it when gulliver_preflight says needs_rehearsal, or when joins or skew make the estimate unreliable; the growth exponent flags joins that multiply rows. Logs a receipt for gulliver_receipt.

Input Schema

NameRequiredDescriptionDefault
sqlYesExactly one SQL statement (SELECT/WITH) in the connection's dialect. Several statements are rejected.
methodNoauto: block sampling (system, cheap) for big tables, row sampling (bernoulli, more even) for small ones. system: always blocks. bernoulli: always rows.auto
sampleNoSample only the largest table (default, keeps joins honest; in a self-join only its first occurrence) or every table and occurrence with its own seed (cheaper, rougher for joins).largest
fractionsNoSample sizes as fractions between 0 and 1, smallest first. Default [0.01, 0.03, 0.1]. At least two are needed to fit a prediction.
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 / 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 / fractions / description
      Previous value: -"Sample sizes between 0 and 1. Default [0.01, 0.03, 0.1]."New value: +"Sample sizes as fractions between 0 and 1, smallest first. Default [0.01, 0.03, 0.1]. At least two are needed to fit a prediction."
    • changedInput schema / properties / method / description
      Previous value: -"Sampling method. auto picks block sampling for big tables."New value: +"auto: block sampling (system, cheap) for big tables, row sampling (bernoulli, more even) for small ones. system: always blocks. bernoulli: always rows."
    • 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. Changed4 schema fields changedv0.1.1
    • changedInput schema / properties / sample / description
      Previous value: -"Sample only the largest table (default, keeps joins honest) or every table."New value: +"Sample only the largest table (default, keeps joins honest; in a self-join only its first occurrence) or every table and occurrence with its own seed (cheaper, rougher for joins)."
    • addedOutput schema / properties
      Added value: +{
      +  "next_step": {
      +    "type": "string"
      +  },
      +  "status": {
      +    "enum": [
      +      "ok",
      +      "warn",
      +      "block",
      +      "needs_rehearsal",
      +      "needs_approval",
      +      "skipped",
      +      "fail",
      +      "error"
      +    ],
      +    "type": "string"
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "status",
      +  "next_step"
      +]
    • changedOutput schema / title
      Previous value: -"gulliver_rehearseDictOutput"New value: +"GulliverResult"
  3. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, and the description reinforces 'Never writes data' plus adds cost context ('budget-checked first') and an important side effect the annotations do not cover: a receipt is logged for gulliver_receipt. It also documents the growth-exponent signal for join row multiplication, which is genuinely useful behavior beyond the structured fields.

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-loads the core action and keeps cost, safety, and routing in tight sentences; the parenthetical about default sample sizes is slightly redundant with the schema but costs little. No padding sentences overall.

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?

With an output schema present, return values needn't be explained, and the description covers purpose, cost, safety, routing, and receipt side effects. Minor gaps remain around failure modes (e.g. what happens when the sample is too small or the prediction cannot be fitted) for a tool with five parameters.

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% and each parameter is fully documented, so baseline is 3. The description only restates the default fractions (1%, 3%, 10%) and adds no syntax or interpretation guidance for method, sample, or connection beyond what the schema already explains.

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 concrete action chain: sample the query at small fractions, measure runtime/rows/bytes, and predict the full run with a confidence range. That is clearly distinct from gulliver_run (full execution) and gulliver_preflight (pre-check), both of which are named or implied.

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 triggers ('when gulliver_preflight says needs_rehearsal, or when joins or skew make the estimate unreliable') and names the sibling that routes into it, so an agent knows both when to select it and when not to.

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