Skip to main content
Glama
S-CurveLabs

io.github.S-CurveLabs/sqlglass

Official
by S-CurveLabs

save_query

Save SQL queries to a versioned library with parameters, tags, and optional overwrite, including DDL scripts for reuse and version tracking.

Instructions

Save a query to the library as .sql (id may contain folders: 'purchasing/open-pos-by-vendor'). sql is the body only -- do not DECLARE the parameters in it; describe them in params: [{"name": "@Start", "type": "date", "default": "'2026-01-01'", "description": "first order date"}] Updating an existing query needs overwrite=true; header fields left empty keep their current value. kind='script' stores DDL text from build_create_table / build_procedure / build_view (e.g. id 'ddl/usp_open_pos'): kept and versioned with the queries, but never linted as a query and never executed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
sqlYes
kindNo
nameNo
tagsNo
paramsNo
dry_runNo
overwriteNo
connectionNo
descriptionNo

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. It discloses that sql is body-only, that empty header fields keep current values during updates, and that script-type queries are never linted or executed. It does not mention permissions or error behavior, but the disclosed behaviors are significant and go beyond the schema.

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?

The description is dense but well-organized with line breaks and an example. It front-loads the primary purpose and then details special cases. Every sentence contributes, though it is longer than average; the structure supports readability without excess.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 10 parameters and no output schema, the description covers the most complex aspects (params format, overwrite, kind) but omits several parameters and does not describe return values or error conditions. Given the complexity, the description is partially complete but leaves gaps that an agent might need to resolve.

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?

The schema has 0% description coverage, so the description must compensate. It explains id, sql, params (with a JSON example), overwrite, and kind. However, it leaves name, tags, dry_run, connection, and description unexplained, which is a notable gap for a 10-parameter tool. The partial coverage earns a mid score.

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?

The description clearly states the tool saves a query to the library as <id>.sql, distinguishing it from siblings like get_query, delete_query, and run_query by its write-to-library action. The inclusion of folder paths and special handling for kind='script' further clarifies its specific role.

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?

The description provides concrete usage rules: how to format the params array, that overwrite=true is required for updates, and that kind='script' is for DDL text. It does not explicitly compare against sibling tools or state when to use save_query over others, but the operational guidance is strong and actionable.

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