Skip to main content
Glama

Read Query

readQuery
Read-onlyIdempotent

Execute read-only SQL queries like SELECT and EXPLAIN to retrieve, aggregate, or check data from database tables. Results are paginated for large datasets.

Instructions

Execute a read-only SQL query. Allowed statements: SELECT, EXPLAIN.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoOpaque pagination cursor. Omit (or pass `null`) for the first page. On subsequent calls, pass the `nextCursor` returned by the previous response verbatim. Cursors are opaque — do not parse, modify, or persist. Ignored for `EXPLAIN` statements.
queryYesThe SQL query to execute.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
nextCursorNoOpaque cursor pointing to the next page. Absent when this is the final page, when the result fits in one page, or when the statement is a non-`SELECT` kind that does not paginate (e.g. `SHOW`, `EXPLAIN`).
rowsYesResult rows, each a JSON object keyed by a column name.
Behavior5/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, idempotentHint=true. The description adds value by specifying allowed statements, describing the return format (<what_it_returns>), explaining pagination behavior (<pagination>) including that EXPLAIN ignores cursor, and showing examples. No contradiction with annotations.

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?

The description is well-structured with clear sections using XML-like tags (usecase, when_not_to_use, examples, what_it_returns, pagination). It is concise but comprehensive, with no redundant information. Every sentence adds value.

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?

Given the complexity of the tool (SQL queries with pagination), the description covers all necessary aspects: allowed statements, usage guidance, examples, return structure, and pagination details. The presence of an output schema further reduces the need to describe return values in depth.

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% with both cursor and query described in the input schema. The description adds extra context: the pagination section explains cursor usage in detail, and examples illustrate valid queries. While the schema already provides good baseline, the description complements it effectively.

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 states 'Execute a read-only SQL query. Allowed statements: SELECT, EXPLAIN.' It uses a specific verb and resource, and distinguishes from siblings by referencing writeQuery, explainQuery, listTables, and getTableSchema in the when_not_to_use section.

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

Usage Guidelines5/5

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

The description includes explicit <usecase> and <when_not_to_use> sections listing when to use the tool and when not to, with clear references to sibling tools. It also provides examples of correct and incorrect usage, making it easy for an agent to decide when to invoke this tool.

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/haymon-ai/dbmcp'

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