Skip to main content
Glama

Run SQL

query
Read-only

Executes one read-only SQL statement and returns up to 100 rows, using placeholders and params for value binding.

Instructions

Runs one SQL statement in a read-only transaction and returns up to 100 rows. Use $1, $2 (Postgres) or ? (SQLite) with params for values. SQL uses table and column SQL names, not TypeScript keys.

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": "query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesOne statement, such as a SELECT.
limitNoRows to return, up to 100.
paramsNoValues for the placeholders in `sql`, in order: $1, $2 on Postgres, ? on SQLite.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, destructiveHint=false and openWorldHint=false, so the safety profile is covered. The description adds real context beyond that: exactly one statement per call, execution inside a read-only transaction, and a 100-row return ceiling — all behavioral constraints an agent could otherwise only discover by failing.

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 sentences, front-loaded with the operation and its limits, then parameter mechanics. Nothing is repeated verbatim beyond essentials and no sentence is filler.

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?

With no output schema, the description correctly covers the return surface (row count ceiling). It leaves out whether truncation is silent, and what happens on error or on an attempted write, which matters for an open-ended SQL tool, but the core is covered.

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, but the description contributes the placeholder convention ($1/$2 on Postgres, ? on SQLite) alongside the schema and, more importantly, warns that SQL references tables and columns by SQL names rather than TypeScript keys — a non-obvious mapping the schema does not state.

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 and resource ('Runs one SQL statement in a read-only transaction') plus the result shape ('up to 100 rows'). Implicitly separable from siblings like count, explain and schema, though it never names them to sharpen the distinction.

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 single-statement, read-only constraint implies when this tool applies, but there is no explicit guidance about when to prefer count or explain, or about what to do when a write is needed. Usage is inferable rather than stated.

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