Skip to main content
Glama
sql-analyst
by Yehiak

Run a read-only SQL query

run_sql
Read-onlyIdempotent

Executes one read-only SELECT query against the database and returns rows; unsafe or failed queries are rejected with the reason so you can correct them and rerun.

Instructions

Run one read-only SQL query and return its rows.

The query is parsed and checked first: only SELECT on this database's tables, no functions that read files, URLs or settings. A refused or failed query returns the reason, so you can fix it.

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
sqlYesOne SELECT (or WITH ... SELECT) query in the database's dialect (see list_tables).
max_rowsNoMaximum rows to return (1-1000).

Output Schema

NameRequiredDescriptionDefault
sqlYesThe query that actually ran (normalised by the guard, with the row cap applied).
rowsYes
columnsYes
row_countYes
truncatedYesTrue if more rows exist than were returned.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already cover readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so safety is pre-established. The description adds genuinely new behavior: the query is parsed and validated before execution, file/URL/settings-reading functions are blocked, and refusals return a reason that allows correction. It omits execution limits such as timeouts or cost, which keeps it short of a 5.

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?

Three short sentences, front-loaded with the action, then the validation constraint, then error behavior. Every sentence carries distinct information and nothing is restated from the schema or annotations.

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

Completeness4/5

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

For a two-parameter tool with full schema coverage, an output schema, and rich annotations, the description fills the remaining gaps: validation semantics and the fact that failures return actionable reasons. It would be complete at 5 if it acknowledged resource limits or how the dialect should be determined, though the schema already points at list_tables for that.

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 both parameters are already documented including the max_rows range and default. The description's only marginal contribution is that a single statement is expected ('Run one ... query') and that rows come back, which is already implied by the schema. Baseline 3 applies.

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?

Specific verb and resource: 'Run one read-only SQL query and return its rows', with the scope qualifier 'one' and 'on this database's tables'. It is clear what the tool does, though it never explicitly contrasts itself with the sibling ask_data, which an agent might otherwise reach for on the same data.

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?

Usage is implied rather than stated: the agent can infer this is the tool for hand-written SELECT queries, and the SELECT-only rule implicitly rules out DDL/DML. There is no explicit when-to-use versus ask_data or describe_table, and no statement of the condition under which a natural-language query tool would be preferable.

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

Deploy Server

Other Tools