Skip to main content
Glama
mcpsmiths

cost-guard-mcp

by mcpsmiths

estimate_query_cost

Read-only

Estimate SQL query cost before execution to avoid overspending. Provides precision-tiered dollar estimates for BigQuery, Snowflake, and Databricks, enabling informed decisions on expensive queries.

Instructions

Estimate the cost of a SQL query before running it. ALWAYS call this before running an expensive-looking query. The response's accuracy_tier tells you how much to trust the number: PRECISE (exact), UPPER_BOUND (real cap, may overstate), HEURISTIC (rough).

warehouse_size (Snowflake/Databricks only, e.g. "SMALL", "X-Large") and edition
(Snowflake only, e.g. "enterprise") default to the smallest/standard tier if omitted —
set them to match the warehouse you actually run this query on, or the dollar figure
will understate cost on a larger warehouse.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
engineYes
editionNo
warehouseNo
warehouse_sizeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
engineYes
caveatsNo
currencyNoUSD
accuracy_tierYes
estimated_bytesNo
estimated_cost_usdNo

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

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

Annotations already indicate readOnlyHint, but the description goes well beyond by explaining the accuracy_tier semantics (PRECISE, UPPER_BOUND, HEURISTIC) and the impact of warehouse_size/edition defaults on cost understatement. This adds valuable behavioral context that annotations alone do not provide, such as the trustworthiness of the returned number and how to get a more accurate estimate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is relatively long but every sentence earns its place: purpose and usage directive are front-loaded, followed by the accuracy tiers, then the optional-parameter caveat. It is well-structured and information-dense without redundancy.

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 cost-estimation tool with an output schema, the description covers all aspects an agent needs: what to pass, accuracy tiers (likely an output field), and how to tune inputs for a reliable estimate. There are no obvious gaps in calling it correctly; even error conditions are implicitly covered by the accuracy-tier guidance.

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 description coverage is 0%, so the description carries the full burden for parameters. It explicitly explains warehouse_size (engine-specific) and edition (engine-specific), their defaults, and the consequences of omission (understated cost). It also ties engine to available tiers. This fully compensates for the schema gap, leaving no parameter unaddressed beyond the obvious sql and engine.

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 states a specific verb ('Estimate') and resource ('cost of a SQL query'), and clearly frames it as a pre-run estimation. It distinguishes itself from siblings like run_query_bounded (which likely executes) and check_credentials (credential verification) by being strictly an estimation tool. No ambiguity.

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 explicitly says 'ALWAYS call this before running an expensive-looking query', which is a clear directive for when to use. However, it does not mention when not to use or explicitly reference alternatives like run_query_bounded. It gives strong context but lacks the 'when-not' and alternative naming, so a 4 is appropriate.

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