Skip to main content
Glama
S-CurveLabs

io.github.S-CurveLabs/sqlglass

Official
by S-CurveLabs

run_query

Read-only

Run a read-only SQL query and return the first rows, using inline SQL or a saved library query. Refuses non-SELECT/WITH statements for safe database access.

Instructions

Run a read-only query and return the first rows. Give either inline 'sql' or a library 'query' (id or name). params: {"@Start": "2026-01-01"}; library queries fall back to their header defaults. Anything but SELECT/WITH is refused before reaching the database. Rows are capped at the connection's max_rows (lower it with max_rows=); to look at big data, aggregate in SQL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlNo
queryNo
paramsNo
max_rowsNo
connectionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true, but the description adds valuable behavior: refusal of non-SELECT/WITH statements before reaching the database, capping rows by connection max_rows, library query fallback behavior, and guidance to aggregate in SQL for large data. This goes well 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?

Four dense, purposeful sentences with no filler. The primary action is front-loaded, followed by parameter guidance, safety restrictions, and row-limit behavior. Every sentence 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?

The description is self-sufficient for selecting and invoking the tool: it explains the query source, parameters, safety gate, row limits, and how to handle large datasets. Even without an output schema, 'return the first rows' plus the cap explanation gives enough expectation for the return behavior.

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

Parameters5/5

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

Schema description coverage is 0%, but the description compensates well. It clarifies the sql/query mutual exclusivity, the params object with an example, max_rows purpose, and connection context. All five parameters receive meaningful explanation despite the empty schema descriptions.

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 states a specific verb and resource: 'Run a read-only query and return the first rows.' It clearly differentiates this from siblings like lint_sql, explain_query, or sample_table by emphasizing read-only execution and inline or library query sources.

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 gives clear usage context: choose either inline 'sql' or a library 'query', pass params, and use max_rows to control row count. It also states the SELECT/WITH restriction. It does not explicitly name alternatives or say when not to use the tool, but the guidance is concrete and actionable.

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