Skip to main content
Glama

db_query

db_query
Read-onlyIdempotent

Executes a single read-only SQL statement (SELECT, SHOW, DESCRIBE, or EXPLAIN) against the WordPress database to inspect data safely; include LIMIT to control result size.

Instructions

Run a read-only SQL query (SELECT / SHOW / DESCRIBE / EXPLAIN, one statement). Use LIMIT.

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

Input Schema

NameRequiredDescriptionDefault
sqlYesA single read-only SQL statement

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/idempotent/destructive=false, so the bar is lower; the description still adds real behavior: only one statement per call and a closed set of permitted statement types, which tells the agent that multi-statement or DDL payloads will be rejected. It omits dialect, row caps, and error/timeout behavior, keeping it from a 5.

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 short clauses, zero filler, and the hard constraint (read-only, one statement) is front-loaded ahead of the optimization hint. Every fragment carries information.

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 one-parameter read-only tool with full annotations, a 100% documented schema, and no output schema, this covers the essentials an agent needs to call it correctly. The main remaining gap is that the SQL dialect/underlying database and any result-size cap are never stated, which affects how queries should be written.

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% and the single 'sql' parameter is already documented as 'a single read-only SQL statement', so the baseline would be 3-4. The description adds meaning by enumerating exactly which statement keywords are accepted and reinforcing the single-statement constraint, which materially shapes what the agent should put in that field.

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?

States a specific verb and resource ('Run a read-only SQL query') and enumerates the exact statement families allowed (SELECT/SHOW/DESCRIBE/EXPLAIN), which no sibling tool offers. It does not explicitly contrast itself with the many read siblings (post_list, option_get, etc.) where raw SQL is an alternative, so it stops short of a 5.

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

Usage Guidelines3/5

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

The one-word hint 'Use LIMIT.' is a genuine usage tip that implies results can be large, and the allowed-statement list implies what it will not run. But there is no explicit when-to-use guidance (e.g. prefer post_list/option_get over ad-hoc SQL) and no stated when-not conditions.

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