Skip to main content
Glama

Run SQL

wp_db_query
Destructive

Run one SQL statement against the WordPress database for read-only queries or guarded writes, using placeholders and blocked destructive operations.

Instructions

Run a single SQL statement against the WordPress database. SELECT/SHOW/EXPLAIN are allowed read-only; writes need allow_db_write. Supports %s/%d placeholders through params. DROP DATABASE, GRANT, OUTFILE and multi-statements are blocked.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
paramsNo
confirmNoMust be "write" for non-read statements

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Beyond the broad openWorldHint/destructiveHint annotations, the description enumerates concrete guardrails: DROP DATABASE, GRANT, OUTFILE and multi-statements are blocked, and writes are gated behind allow_db_write. That is meaningful behavioral context the annotations do not carry, though it does not describe result format or failure 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 tightly packed sentences with no filler: operation, permission model, placeholder support, and blocked operations, in that order. Every clause carries operational 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 high-risk execution tool with no output schema, the description covers the critical decision points an agent needs: what is allowed read-only, what requires the write flag, and what is outright blocked. It stops short of describing the return shape or error surfaces, which would be the last gap.

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 description coverage is only 33% (just `confirm` is documented), so the description must compensate. It does so for `params` by explaining the %s/%d placeholder mechanism and mentions the write-gating requirement, but says nothing about the `sql` parameter's constraints (e.g. single-statement enforcement) beyond the paragraph context.

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 a single SQL statement against the WordPress database') and scopes it to one statement. It clearly separates itself from sibling execution tools like wp_php_run, wp_fs and wp_snippet_run by naming the exact execution surface.

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?

Gives explicit read-vs-write conditions: SELECT/SHOW/EXPLAIN are allowed read-only, while writes require the allow_db_write flag. It does not name sibling alternatives (e.g. wp_php_run) for cases where raw SQL is the wrong choice, so a 4 rather than a 5.

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