Skip to main content
Glama

guard_query

Check AI-generated SQL before execution and return an allow, review, or block decision with a clear reason to prevent unsafe database operations.

Instructions

Pre-execution safety hook for AI-generated SQL. Returns a go/no-go decision (allow/review/block) with a human-readable reason and the underlying verdict. Designed to be called before handing SQL to a database MCP server or executing it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesThe SQL statement to check.
dialectNoSQL dialect used to parse the statement.postgres

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/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 burden and does disclose meaningful behavior: the three-way decision model, that a human-readable reason and the underlying verdict are returned, and implicitly that it does not execute the SQL. It omits operational traits such as side effects, auth needs, or error behavior, but the return semantics are unusually well covered.

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?

Two sentences, both load-bearing: the first defines the tool and its return shape, the second states when to call it. The most important information is front-loaded and there is no filler.

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?

For a two-parameter tool with no output schema, the description adequately explains what comes back and when to call it. Its one real gap is the unresolved overlap with validate_sql, which the description should have disambiguated given the sibling set.

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 100%, so both the sql and dialect parameters are already documented in the schema, including the enum and default. The description adds no syntax, format, or dialect-specific guidance beyond that, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific function: a pre-execution safety check on AI-generated SQL that returns an allow/review/block verdict. It is clear what the tool does, but it never distinguishes itself from the sibling validate_sql, which an agent could easily confuse it with.

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 explicit timing guidance ('Designed to be called before handing SQL to a database MCP server or executing it'), which tells the agent exactly where this fits in a workflow. It stops short of naming alternatives or stating when not to use it, especially versus validate_sql.

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

Deploy Server

Other Tools