Skip to main content
Glama

run_sql

Run read-only SQL SELECT queries on a Grist document's SQLite database to analyze, aggregate, and join data across tables.

Instructions

Execute a read-only SQL query against the document's SQLite database. Useful for analysis, aggregation, and joins across tables.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sql": "<sql>"
    },
    "name": "run_sql"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesSQL query (SELECT only)
argsNoPositional query parameters
doc_idNoDocument ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden; it does disclose the key safety trait that the query is read-only, which is genuinely useful. It omits what happens on non-SELECT input, row limits/timeouts, and whether doc_id is required or defaults, so meaningful gaps remain for a query-execution 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?

Two short sentences with the core action front-loaded and the analytical use case second. No redundant wording or filler; every clause contributes.

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?

There is no output schema, so the description could describe the return shape (rows/columns), result limits, or error behavior on invalid SQL. It covers the essential what and read-only constraint but leaves the agent guessing about result characteristics.

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 the schema already documents sql, args, and doc_id; baseline 3 applies. The description adds no syntax, parameter-binding, or doc_id-defaulting detail beyond what the schema states.

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 ('Execute') and resource ('read-only SQL query against the document's SQLite database'), plus the analytical framing. It implicitly separates itself from sibling record tools like get_records by emphasizing analysis, aggregation, and joins, though no sibling is named.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The clause 'Useful for analysis, aggregation, and joins across tables' gives implied usage context, steering agents toward this tool for complex querying. However, there is no explicit when-not guidance or named alternative for simple record retrieval, leaving the routing inference to the agent.

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