Skip to main content
Glama

parse_sql

Read-onlyIdempotent

Parses SQL to return an AST summary with statement count and statement types, optionally for a specific dialect; excludes GO batch separators.

Instructions

Use this when the user wants to know how SQL parses: returns an AST summary with the statement count and the type of each statement, optionally for a specific dialect. GO batch separators are excluded from the count.

Input Schema

NameRequiredDescriptionDefault
sqlYesThe SQL string to parse
dialectNoSQL dialect: generic, postgresql, mysql, mariadb, sqlserver, oracle, sqlite, snowflake, bigquery, redshift, clickhouse

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.17.0
    • addedInput schema / properties / dialect
      Added value: +{
      +  "description": "SQL dialect: generic, postgresql, mysql, mariadb, sqlserver, oracle, sqlite, snowflake, bigquery, redshift, clickhouse",
      +  "enum": [
      +    "generic",
      +    "postgresql",
      +    "mysql",
      +    "mariadb",
      +    "sqlserver",
      +    "oracle",
      +    "sqlite",
      +    "snowflake",
      +    "bigquery",
      +    "redshift",
      +    "clickhouse"
      +  ],
      +  "type": "string"
      +}
  2. First observedv1.12.1

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already cover safety (readOnly, idempotent, non-destructive, closed-world), so the description rightly focuses on behavior beyond that: what the response contains and the non-obvious quirk that GO batch separators are excluded from the statement count. No mention of size limits or dialect fallback behavior, which keeps it off 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?

Two sentences, no filler, with the usage trigger front-loaded and the return semantics immediately after. The clause about GO separators is a worthwhile edge case rather than padding.

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?

With no output schema, the description must convey return shape, and it does (AST summary, count, statement types). Combined with full schema coverage and read-only annotations, an agent has what it needs; only the default-dialect behavior is left implicit.

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 coverage is 100% and the dialect enum lists every accepted value, so the schema carries the load. The description only adds "optionally for a specific dialect" on top of that, which restates rather than enriches parameter meaning (e.g., what happens when dialect is omitted).

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?

States a specific verb and resource (parse SQL) and, unusually, spells out the return payload: an AST summary with statement count and per-statement type. That output shape implicitly separates it from validate_sql/lint_sql/format_sql, though no sibling is named explicitly.

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?

"Use this when the user wants to know how SQL parses" gives a clear trigger condition, and the listed return fields (statement count, statement types) reinforce which questions it answers. It stops short of naming analyze_sql as the alternative or saying when not to use it.

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