Skip to main content
Glama

read_query

Execute read-only SQL queries on PostgreSQL with enforced row limits to safely retrieve data while preventing resource overuse.

Instructions

Execute a safe read-only SQL query (SELECT, WITH, SHOW) with strict LIMIT enforcement and formatting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesRead-only SQL query to execute
limitNoMaximum number of rows to return (default: 100, max: 1000)
Behavior4/5

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

The description proactively discloses key behavioral traits: the tool enforces strict LIMIT enforcement and formatting, and is restricted to read-only queries (SELECT, WITH, SHOW). There are no annotations to contradict or rely on, so the description carries the full burden and handles it well. A slight deduction for not mentioning return format or error handling behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that front-loades the purpose and then adds constraints. It is concise and every phrase adds value. Minor deduction for not using line breaks or bullet points to separate the query types and enforcement rules, though it is still clear as is.

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?

Given the tool is a simple SQL executor with high schema coverage, the description sufficiently covers its core function and constraints. The lack of output schema is acceptable for a query tool; the description implies formatted output. However, it could mention potential error cases (e.g., malformed SQL, privilege issues) or that results are returned in a tabular format to be fully complete for an agent.

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% – the input schema already documents the 'sql' and 'limit' parameters with descriptions. The description adds general context about LIMIT enforcement and formatting but does not elaborate on parameter syntax, validation rules, or behavior beyond what is in the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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 clearly specifies the action ('Execute'), the resource ('SQL query'), and narrows the scope with 'safe read-only', listing permitted SQL commands (SELECT, WITH, SHOW). It explicitly mentions enforcement of LIMIT and formatting rules, setting it apart from potentially similar query or analysis tools in the sibling list. This leaves no ambiguity about the tool's purpose.

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 implicitly states when to use the tool via the 'safe read-only' qualifier and the listed SQL commands. The sibling tools include read-only informational tools (e.g., list_schemas, explain_query) and write-related tools; however, no explicit 'when not to use' or direct comparison to siblings is provided. The context is clear but exclusions are omitted, warranting a 4.

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/mewsyy/pg-context'

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