Skip to main content
Glama

Sql Generate

sql_generate
Read-only

SQL from a question and a schema (CREATE TABLE statements or a JSON description of tables and columns), for postgres (default), mysql, sqlite or bigquery. The tables and columns used are checked against the schema; a query that does not match it is retried once, then refused. Writes (INSERT, UPDATE, DELETE, DDL) are refused unless allowWrite is true. The query is not run. Price: $0.003 in USDC per successful call, paid with x402 (Base, Solana or Arc); failed calls are not charged.

Input Schema

NameRequiredDescriptionDefault
schemaYesCREATE TABLE statements, or a JSON object of tables and column lists (max 20,000 characters)
dialectNopostgres (default), mysql, sqlite or bigquery
questionYesQuestion in plain language (max 1,000 characters)
allowWriteNoAllow INSERT, UPDATE, DELETE or DDL (default false)

Output Schema

NameRequiredDescriptionDefault
sqlNo
noteNo
tablesNo
columnsNo
dialectNo
readOnlyNo
checkedAtNo
explanationNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • addedOutput schema / properties / checkedAt
      Added value: +{}
    • addedOutput schema / properties / columns
      Added value: +{}
    • addedOutput schema / properties / dialect
      Added value: +{}
    • addedOutput schema / properties / explanation
      Added value: +{}
    • addedOutput schema / properties / note
      Added value: +{}
    • addedOutput schema / properties / readOnly
      Added value: +{}
    • addedOutput schema / properties / sql
      Added value: +{}
    • addedOutput schema / properties / tables
      Added value: +{}
  2. Added

TDQS

A4.4/5.0
Behavior5/5

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

Goes well beyond the readOnlyHint/openWorldHint annotations: table/column validation against the supplied schema, a single retry then refusal, write-statement blocking gated by allowWrite, non-execution of the query, and a per-successful-call price with failed calls free. This is exactly the operational detail an agent needs before calling.

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 core purpose, then layers constraints and pricing in compact sentences with no filler. The pricing clause is long but carries decision-relevant cost information, so it earns its place.

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?

Given an output schema exists, return values need not be described; everything else an agent needs – supported dialects, validation/retry/refusal semantics, write gating, non-execution, and cost – is present. Nothing material 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?

Schema coverage is 100%, so the schema already documents question, schema, dialect, and allowWrite. The description reinforces the dialect default and the allowWrite gate but adds no format or syntax detail beyond the structured fields, so the baseline of 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 and resource ('SQL from a question and a schema') and enumerates the supported dialects with the default. An agent can immediately tell this is SQL generation, not execution, and distinguish it from unrelated siblings like tables or regex_generate.

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?

Clear context: pass a question plus a CREATE TABLE/JSON schema, expect checked-and-retried output, and note that the query is NOT run. It does not name explicit alternatives among siblings, but the 'generation only, not execution' framing implicitly routes the agent away from any execute-style tool.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources