Skip to main content
Glama
jgravelle
by jgravelle

run_sql

Read-only

Run read-only SELECT and WITH queries across datasets to handle complex aggregations, window functions, CTEs, and multi-way joins beyond structured tool limits.

Instructions

Read-only sandboxed SQL escape hatch (B1). Accepts a single SELECT (or WITH … SELECT) statement. The first dataset is the main connection; additional datasets are ATTACHed under schema names (e.g. <dataset>.rows). Statement runs under PRAGMA query_only=1 with a 10-second budget and 500-row cap. Use this for HAVING / window functions / CTEs / multi-way joins that the structured tools don't cover.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSELECT or WITH … SELECT statement
limitNoRow cap (default 500, hard max 500)
redactNoScrub PII / credentials from result cells before return (default true).
datasetsYesIndexed datasets to attach. Order matters: datasets[0] is the main connection.
redact_patternsNoAdditional Python regex patterns to layer on top of the built-in set.
redact_skip_columnsNoResult column names to exempt from redaction.
Behavior5/5

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

Beyond the readOnlyHint annotation, it discloses execution constraints (PRAGMA query_only=1, 10-second budget, 500-row cap), dataset attachment semantics (first is main, others ATTACHed under schema names), and a naming example. This provides substantial behavioral context beyond the annotation.

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?

The description is three tight sentences: purpose first, then constraints/behavior, then usage guidance. No wasted words, and every sentence adds distinct value.

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?

Even without an output schema, the description covers safety, execution limits, dataset attachment, and usage scope. Given the tool's complexity (SQL execution with 6 params), this is comprehensive enough for an agent to select and invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds useful semantics for the 'datasets' parameter (order matters, first is main connection, others attached under schema names) and the row-cap limit, but most parameter details are already in the schema. This modest extra value justifies a 4.

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 explicitly identifies the tool as a 'read-only sandboxed SQL escape hatch' that accepts single SELECT or WITH…SELECT statements, and differentiates it from structured tools by targeting HAVING/window functions/CTEs/multi-way joins. This clearly states both the verb/resource and its unique scope.

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

Usage Guidelines5/5

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

It provides direct usage guidance: 'Use this for HAVING / window functions / CTEs / multi-way joins that the structured tools don't cover.' This also implies when not to use it (if structured tools cover the case) and names the alternative tool category.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jgravelle/jdatamunch-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server