Skip to main content
Glama

Query the database (read-only)

query_database
Read-only

PHP + MySQL plans: runs one read-only SQL statement (SELECT, SHOW, DESCRIBE, EXPLAIN or WITH … SELECT) against the site's database and returns the rows. Runs in a read-only transaction; use execute_sql to change data. Use ? placeholders with params for values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteYesThe website's domain, as shown by list_sites (e.g. "example.com" or "name.hostingfor.ai").
queryYesOne SQL statement.
paramsNoValues for ? placeholders, in order.
max_rowsNoMaximum number of rows to return.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteNo
rowsNoOne object per row, keyed by column name.
columnsNo
warningsNo
insert_idNo
more_rowsNo
row_countNo
duration_msYes
affected_rowsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the readOnlyHint annotation, the description adds that the query 'runs in a read-only transaction' and restricts the accepted SQL statement types. These details explain behavioral boundaries that the annotation does not convey, making the tool safe and predictable to invoke.

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?

Two sentences carry the essential information: the operation and allowed statements, then the alternative tool and parameter style. It is front-loaded with the core behavior and contains no filler.

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 output schema already documents return values and the input schema covers max_rows, the description covers all remaining operational context: statement types, read-only guarantee, alternative for writes, and placeholder usage. Nothing needed for correct invocation is missing.

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 adds meaningful parameter semantics with its explanation of ? placeholders matched to the params array, which clarifies how to pass values. It does not redundantly restate the schema definitions.

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 states a specific action ('runs one read-only SQL statement') against a specific resource ('the site's database') and enumerates the permitted statement types (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH ... SELECT). This clearly distinguishes it from siblings like execute_sql, and the title reinforces the read-only nature.

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?

It explicitly routes to execute_sql for data changes ('use execute_sql to change data'), giving a clear when-not-to-use condition. It also instructs on placeholder usage ('Use ? placeholders with params for values'), which is essential for correct invocation.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources