Skip to main content
Glama

execute_sql

Read-only

Run bounded read-only SQL queries against PostgreSQL to inspect data, with configurable row and cell limits plus truncation notices when output is capped.

Instructions

Execute a read-only SQL query. Long cells are shortened; pass max_cell to read more. The result is also capped at 32768 bytes, whatever max_rows says; the footer says so when it is cut.

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

Input Schema

NameRequiredDescriptionDefault
sqlYesSQL to run
max_cellNoMaximum characters per cell before it is shortened (default 200, at most 10000)
max_rowsNoMaximum rows to return (default 100, at most 1000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false and openWorldHint=false, so safety is covered. The description adds real behavioral value beyond those annotations: it discloses cell shortening, the 32768-byte hard cap that overrides max_rows, and the footer marker on truncated output. It does not cover error behavior, statement-count limits, or timeouts.

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 core verb and scope, followed by the two truncation facts an agent actually needs. Nothing is redundant or padded.

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 three-parameter read-only query tool with no output schema, the description covers the main traps: silent cell shortening and the byte cap that overrides max_rows. Minor gaps remain, such as the shape of the returned result and what happens on SQL errors, but the essentials are present.

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 goes further by explaining that max_cell controls cell shortening and, more importantly, that the byte cap overrides max_rows, which is a cross-parameter interaction the schema cannot express.

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?

The description gives a specific verb and resource ("Execute a read-only SQL query") and clearly flags the read-only constraint. However, it never distinguishes this general-purpose query tool from sibling analytical tools such as explain_query or get_top_queries, so an agent must infer when to reach for raw SQL instead.

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

Usage Guidelines2/5

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

The description contains no when-to-use or when-not-to-use guidance, and it does not point to any alternative tool. The only guidance is operational, about truncation and max_cell, rather than about which tool to select for a given task.

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