Skip to main content
Glama

suggest_query

Grade a candidate SQL query for cost and risk before execution; get accept/refine guidance plus verified cheaper rewrites for expensive or dangerous patterns.

Instructions

Grade a query you (the agent) wrote for a user's data request and get told whether to RUN it or REFINE it — the check step of generate->check-> refine. Workflow: (1) describe_schema_tool to learn columns + indexes, (2) write a candidate for the user's intent, (3) call this. Returns next_action: 'accept' (cheap/moderate — run it) or 'refine' (expensive/ dangerous — here are the high-severity flags + a VERIFIED cheaper rewrite; fix and call again). You write the SQL; Anumana owns cost truth. Bound your loop to ~3 rounds. Pass target= in a multi-DB setup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
intentYes
targetNo
candidate_sqlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden and does well: it discloses the return contract's semantics ('accept' = cheap/moderate, run it; 'refine' = expensive/dangerous with high-severity flags and a verified cheaper rewrite) and clarifies the division of labor ('You write the SQL; Anumana owns cost truth'). It omits error/auth conditions and whether the rewrite is applied automatically, keeping it short of a 5.

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 purpose, then the workflow, then the return semantics, with no filler sentences. It is dense with parentheticals and dash clauses, but each element (loop bound, multi-DB target, cost ownership) carries actionable information.

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, so the description need not enumerate return fields, and it still explains the meaning of next_action values. Given a 3-param tool with no annotations, the coverage of workflow, loop limits, and cost-ownership is nearly complete; only edge cases like malformed SQL or target resolution failures are unaddressed.

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 compensate, and it largely does: candidate_sql is framed as the query the agent wrote, intent as the user's data request, and target is given real meaning ('in a multi-DB setup'). It adds context the raw schema lacks, though it never states intent's expected format (natural language vs. structured).

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 ('grade a query ... whether to RUN it or REFINE it') and positions the tool as the check step of a generate->check->refine loop. The agent can distinguish it from write-side siblings like rewrite_query and from schema-side siblings like describe_schema_tool.

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 an explicit numbered workflow (describe_schema_tool -> write candidate -> call this), states the alternative branch ('refine' means fix and call again), bounds the loop to ~3 rounds, and tells the agent to pass target=<name> in a multi-DB setup. When-to-use and when-to-refine are both spelled out.

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