Skip to main content
Glama

Query a site's database

db_query
Destructive

Run one SQL statement on a site's database, connecting with the site's own credentials (you never need the password). SELECT, SHOW, DESCRIBE and EXPLAIN run straight away in a read-only transaction; anything that changes data needs the user's approval. Remember the table prefix from list_sites.

Input Schema

NameRequiredDescriptionDefault
sqlYes
whyNoOne plain sentence for the user, shown on the approval page if this call needs their approval: what it does and why it is needed.
siteNoSite root folder, like /var/www/shop, or one of the site's domains. Optional when the server has one site (see list_sites).
serverNoServer name or id. Optional when the account has one server.
max_rowsNoDefault 200, max 1000.
approval_idNoOnly when repeating a call the user approved.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations only give coarse hints (destructiveHint=true, readOnlyHint=false, openWorldHint=true); the description usefully refines this by splitting read-only statements from mutating ones, disclosing that the site's own credentials are used with no password needed, and describing the approval flow. It stops short of mentioning row-limit or result-format behavior.

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 tight sentences with the core action front-loaded, followed by the read/write execution rule and the prefix reminder. No 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?

For a 6-parameter, no-output-schema tool with 83% schema coverage, the description covers the critical operational details: credential handling, read vs write execution, and approval semantics. Minor gap is the absence of any note on result shape or row limits.

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 already 83%, so nearly every parameter is self-documenting, including 'why' and 'approval_id'. The description adds only the reminder about the table prefix, which is marginal value on top of the schema.

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?

States a specific verb and resource ('Run one SQL statement on a site's database') and bounds the scope to a single statement. It is clearly distinguishable from siblings like db_dump, db_restore, and list_sites.

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?

Explains when the call runs immediately (SELECT/SHOW/DESCRIBE/EXPLAIN in a read-only transaction) versus when user approval is required (anything that changes data), and points to list_sites for the table prefix. It does not explicitly contrast with db_dump/db_restore, so it falls short of a full when/when-not routing statement.

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