Skip to main content
Glama
mcpsmiths

cost-guard-mcp

by mcpsmiths

run_query_bounded

Execute a database query only when its pre-flight cost estimate falls within your specified dollar, byte, or row limits; otherwise it is refused with an explanation, preventing unexpected charges.

Instructions

Run a query only if its pre-flight cost estimate is within your given bounds; refuses otherwise (check result.status — "refused" means it did NOT run and result.hint explains why). NOTE: unlike estimate_query_cost, a successful call here has a real monetary/quota side effect — don't call this repeatedly without inspecting the result of each call.

warehouse_size/edition (see estimate_query_cost) default to the smallest/standard tier
if omitted - set them to match the warehouse you actually run on, since max_estimated_cost_usd
is checked against the estimate they produce.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
engineYes
editionNo
max_rowsNo
warehouseNo
warehouse_sizeNo
max_bytes_billedNo
max_estimated_cost_usdNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
hintNo
rowsNo
reasonNo
statusYes
estimateNo
row_countNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.1.1
    • addedInput schema / properties / edition
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Edition"
      +}
    • addedInput schema / properties / warehouse_size
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Warehouse Size"
      +}
  2. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations only indicate readOnlyHint=false and openWorldHint=true. The description adds valuable behavioral context: it discloses the refusal behavior (result.status='refused') and the side-effect warning. It also explains the default behavior for warehouse_size and edition. This goes beyond annotations and provides the agent with essential operational expectations.

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 description is structured into three focused paragraphs: the core behavior, the side-effect warning, and the parameter defaults. Every sentence adds necessary information, with the primary purpose front-loaded. It is somewhat lengthy but justified given the tool's complexity; no redundant phrasing is present.

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?

The tool has 8 parameters and an output schema, so the description need not explain return values. It covers the key behavioral aspects (refusal, side effects, defaults) and gives enough context for safe usage. The main gap is the lack of detail for some parameters (e.g., max_rows, max_bytes_billed), but these are less critical than the cost-bound logic and are reasonably inferable from names. Overall, it is sufficiently complete for a complex tool.

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 description coverage is 0%, so the description must compensate. It explicitly explains warehouse_size and edition defaults and implies the role of max_estimated_cost_usd. However, it does not describe sql, engine, max_rows, max_bytes_billed, or the exact semantics of the bounds check. This is a partial compensation, leaving significant parameter meaning to be inferred by the agent.

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 clearly states a specific verb ('Run'), resource ('a query'), and the conditional constraint ('only if its pre-flight cost estimate is within your given bounds'). It explicitly distinguishes itself from the sibling tool estimate_query_cost by contrasting the side effect. This leaves no ambiguity about what the tool does or how it differs.

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?

The description gives explicit usage guidance: it warns that a successful call has a real monetary/quota side effect and advises against repeated calls without inspecting results, directly contrasting with estimate_query_cost. However, it does not mention when to use or avoid relative to other siblings like check_credentials or describe_engine_capabilities, though those are not directly competing. The guidance is clear and actionable.

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