Skip to main content
Glama
Strom-Capital

mcp-server-db2i

Validate SQL Query

validate_query
Read-onlyIdempotent

Check SQL statements without executing them by parsing references and confirming tables, columns, and routines exist, while reporting read-only and schema-allowlist issues.

Instructions

Check a SQL statement without running it. Parses it with QSYS2.PARSE_STATEMENT and checks that referenced tables, columns, and qualified routines exist in the catalog. Also reports read-only and schema-allowlist findings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL statement to validate. It is not executed.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
causeNoWhy the statement failed. &1-style placeholders stand for values in error.
errorNo
validNo
sqlcodeNoSQLCODE of the failed statement, such as -204
successYes
recoveryNoWhat to change before trying again
sqlstateNoSQLSTATE of the failed statement
warningsNo
violationsNo
missingTablesNo
statementTypeNo
missingColumnsNo
skippedFiltersNoAnnotated tables whose row filter, such as leaving out deleted rows, the query does not use. See warnings
missingRoutinesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv3.5.0
    • addedOutput schema / properties / skippedFilters
      Added value: +{
      +  "description": "Annotated tables whose row filter, such as leaving out deleted rows, the query does not use. See warnings",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / warnings
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  2. First observedv3.0.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already establish readOnly, idempotent, non-destructive, closed-world behavior, so the bar is lower. The description adds meaningful mechanics beyond that: parsing via QSYS2.PARSE_STATEMENT, catalog resolution of tables/columns/routines, and that read-only and schema-allowlist findings are reported.

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 tight sentences, front-loaded with the core action and the non-execution guarantee before the implementation detail. Every clause earns its place with no 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?

An output schema exists, so return-value explanation is unnecessary, and the description covers the action, the mechanism, the checks performed, and the non-execution guarantee. Nothing an agent needs to call it correctly is missing.

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?

With a single parameter at 100% schema description coverage, the schema already carries the semantics. The description reinforces that the statement is not executed, which mirrors the schema text rather than adding new meaning, so the baseline 3 applies.

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 ('Check a SQL statement') plus the crucial scoping constraint 'without running it', and explains the mechanism (QSYS2.PARSE_STATEMENT plus catalog existence checks). This clearly separates it from the sibling execute_query, which actually runs SQL.

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?

'without running it' implicitly tells the agent to use this before execute_query, and the enumeration of checks makes the intended use case clear. It stops short of explicitly naming execute_query as the alternative or stating when validation is mandatory, so it is clear context rather than full routing guidance.

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