Skip to main content
Glama

validate_sql

Validate AI-generated SQL against a configured schema before execution to get a safe, review, or blocked verdict with issue codes and fixes.

Instructions

Validate a SQL statement against the configured schema. Returns a verdict (safe/review/blocked), a list of issues with codes, severities, messages and fix suggestions, plus a plain-English explanation. Call this before executing AI-generated SQL.

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 largely meets it: it discloses the output taxonomy (safe/review/blocked verdicts, issue codes, severities, messages, fix suggestions, plus a plain-English explanation). It does not state whether validation is purely static or requires a live connection, and it never confirms that the SQL is not executed — a meaningful omission for a guardrail tool.

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?

Three short sentences, front-loaded with purpose, then return shape, then the call condition. Nothing is redundant and every sentence carries distinct 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?

There is no output schema and no annotations, so the description must explain both purpose and returns — and it describes the verdict and issue structure well. The remaining gap is behavioral rather than structural: no statement about side effects, permissions, or whether a schema must be pre-configured for the call to succeed.

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 parameters (sql, dialect) are already documented in the schema with an enum and default. The description adds no syntax, format, or dialect-specific guidance beyond that, so the baseline of 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 verb and resource ("Validate a SQL statement against the configured schema") and immediately names the artifact produced (a verdict). It does not differentiate itself from the sibling guard_query, which plausibly also performs SQL safety checking, leaving the agent to infer the boundary.

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 an explicit trigger — "Call this before executing AI-generated SQL" — which tells the agent when this tool belongs in a workflow. It offers no when-not condition and never names explain_sql or guard_query as alternatives, so the routing guidance is incomplete but the positive case is unambiguous.

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