Skip to main content
Glama

execute_sql

Destructive

Run SQL queries against the WordPress database via $wpdb to retrieve rows or insert, update, and delete records, using {prefix} for table names.

Instructions

Run a SQL query against the WordPress database via $wpdb. SELECT queries return rows; INSERT/UPDATE/DELETE return the affected row count. Table prefix is available as {prefix} in your query (e.g. SELECT * FROM {prefix}posts LIMIT 5).

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": {
      "query": "<query>"
    },
    "name": "execute_sql"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesThe SQL query. Use {prefix} for the table prefix.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.1.2

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already flag destructiveHint=true, so the danger profile is carried structurally. The description adds genuinely useful behavior: SELECT returns rows while INSERT/UPDATE/DELETE return an affected row count, which tells the agent what to expect back. It omits important context such as whether writes are permanent/irreversible, permission requirements, or multi-statement support.

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 short sentences, each carrying distinct information: the operation, the return semantics per statement type, and the prefix placeholder with a concrete example. Nothing is redundant or buried.

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 single-parameter tool with no output schema, the description covers what is returned for each statement class and how to reference tables, which is the core information an agent needs. The remaining gap is behavioral risk detail — irreversibility of writes and any permission or safety constraints — which matters for a tool annotated destructive.

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?

With one parameter at 100% schema coverage, the schema already documents the query argument. The description's {prefix} explanation and example repeat the schema's own description of the placeholder rather than adding new meaning, so baseline 3 applies.

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 SQL query against the WordPress database via $wpdb — which is unambiguous. It does not distinguish itself from the nearby escape-hatch sibling execute_php or from db_cleanup_preview, so an agent must infer the boundary itself.

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

Usage Guidelines2/5

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

There is no explicit when-to-use or when-not-to-use guidance, and no alternative is named despite execute_php and db_cleanup_preview sitting in the sibling set. The agent can only infer that this is for raw SQL, with nothing about preferring higher-level tools or when this is appropriate.

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