Skip to main content
Glama

Run PHP on the site

wp_php_run
Destructive

Execute PHP code inside a live WordPress runtime to inspect state, run queries, and capture output or fatal errors. Requires confirm:"run".

Instructions

Execute PHP inside the live WordPress runtime with WordPress loaded ($wpdb, WP_Query, all plugins available). Output buffering and return values are captured; fatal errors are reported. Use it to inspect real state, not to guess. Requires confirm:"run".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPHP without the opening <?php tag
modeNophp = pure code; template = mixed code and HTML outputphp
confirmYesMust be "run"

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare destructiveHint and openWorldHint, so the safety bar is lower; the description adds real value by disclosing that WordPress is fully loaded, that output buffering and return values are captured, and that fatal errors are surfaced. It could say more about persistence (whether executed code alters site state), but the behavioral picture is noticeably richer than the annotations alone.

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?

Four tight sentences, each earning its place: execution context first, then output/error behavior, then the usage directive, then the confirmation requirement. Zero filler and well front-loaded.

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-power execution tool with no output schema, the description covers context loading, result capture and error behavior, which is sufficient to call it correctly. It does not warn about persistence or side effects of arbitrary code, a minor gap that destructiveHint partially offsets.

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 100%, so the schema already documents code, mode (enum with default) and confirm. The description only repeats the confirm:"run" requirement and adds no syntax or format detail beyond the schema, making the baseline 3 correct.

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 (Execute) and resource (PHP inside the live WordPress runtime) with concrete scope, naming $wpdb, WP_Query and plugins as available. It does not, however, differentiate itself from close siblings like wp_snippet_run or wp_db_query, so an agent must infer the boundary.

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?

"Use it to inspect real state, not to guess" gives a clear operating context, and the confirm:"run" prerequisite is stated. It stops short of naming alternatives (e.g., wp_db_query for reads, wp_snippet_run for saved code), so no explicit exclusions are provided.

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