Skip to main content
Glama

Run a WP-CLI command

run_wp_cli

Execute allowlisted WP-CLI commands on WordPress sites without SSH or binary, using a PHP emulation layer. Writing operations require admin and destructive commands like search-replace preview as dry runs before execution.

Instructions

Run a WP-CLI command against the site. Commands are emulated in PHP by the companion plugin — no WP-CLI binary or SSH access is needed on the host. Only allowlisted commands run (see list_cli_commands); everything else is refused. Writing commands need an Administrator account, and search-replace always previews as a dry run before it will touch anything.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoOutput format the command should produce where it supports one.json
commandYesThe command without the leading "wp", e.g. "plugin list --status=active" or "option get blogname".
site_idNoWhich configured WordPress site to act on. Optional — with a single site configured it is used automatically; with several, the default site is used unless you name one. Run list_sites for valid ids.
confirm_tokenNoToken from a previous dry-run preview, required for destructive commands such as search-replace.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.0.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
  2. First observedv1.0.0

TDQS

A4.5/5.0
Behavior5/5

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

It goes well beyond annotations by adding implementation and safety details: commands are emulated in PHP with no binary/SSH dependency, unauthorized commands are refused, writing commands require Administrator credentials, and search-replace requires a dry-run confirmation. This is precisely the behavioral information an agent needs to choose and call it correctly.

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, and each sentence carries distinct information: core action, execution model, and security/completion constraints. The description is front-loaded, readable, and contains no padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with strong schema support and no output schema, the description covers the essential operational safety context: what commands are allowed, who can run mutations, and how search-replace requires confirmation. Nothing essential is missing for an agent to invoke the tool correctly.

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 command, format, site_id, and confirm_token accurately. The description adds only a small extra link between destructive commands and the dry-run/token flow, which is useful but does not substantially improve parameter meaning beyond the structured definitions.

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?

The description opens with a specific verb-object pairing, 'Run a WP-CLI command against the site', and clearly distinguishes the tool from individual plugin/content/theme helpers by framing it as a general command runner. Mentioning the allowlist and list_cli_commands helps an agent separate capabilities without inspecting all siblings.

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?

The description gives a clear necessary condition for usage: the command must be allowlisted, and it points to list_cli_commands for the accepted set. It stops short of explicitly contrasting with sibling shells like rest_api or execute_sql_query, but the WP-CLI and allowlist framing make the intended scope sufficiently clear.

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

Deploy Server

Other Tools