Skip to main content
Glama

AI Engine for WordPress

Edit post text

wp_alter_post
Destructive

Find and replace text inside one field of a post (for example its content), without sending the whole content again. Supports regular expressions with regex set to true and modifiers in flags.

Input Schema

NameRequiredDescriptionDefault
IDYesPost ID.
fieldYesField to modify: post_content, post_excerpt, or post_title.
flagsNoOptional PCRE modifier letters applied in regex mode, e.g. "i" (case-insensitive), "s" (dotall), "m" (multiline). Allowed: i, m, s, x, u, A, D, S, U, X, J.
regexNoTreat search as a regex pattern (default: false).
searchYesText to search for, or (with regex=true) a bare PCRE pattern without delimiters, e.g. <!-- /wp:paragraph -->\s*$
replaceYesReplacement text. In regex mode, backreferences like $1 / \1 are supported.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false and openWorldHint=true, so the risk profile is covered. The description adds regex/flag/backreference capability, but omits critical behavior for a destructive operation: whether all matches or only the first are replaced, what happens when the search pattern matches nothing, and whether this bypasses revisions.

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 sentences with zero padding, and the core distinction (targeted field edit without resending content) is front-loaded ahead of the regex caveat. Nothing here could be cut without losing 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 destructive, open-world mutation tool this covers the essentials: target field, regex mode, and replacement syntax. The remaining gap is the outcome semantics (replace-all vs. first occurrence, no-match behavior), which matters given the destructive annotation and the absence of an output schema.

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 coverage is 100%, so all six parameters are documented in the schema itself. The description's regex/flag sentence largely restates the schema's own regex and flags descriptions without adding new meaning, so this sits at the baseline for a fully-annotated schema.

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 (find and replace) applied to a specific resource (text inside one named field of a post), and adds the distinguishing scope 'without sending the whole content again', which separates it from the full-content siblings. It stops short of naming wp_update_post or wp_write_blocks explicitly, so differentiation must be inferred.

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 phrase 'without sending the whole content again' implies the intended use case (surgical edits vs. a full update), but the description never says when to prefer this over wp_update_post or wp_write_blocks, nor does it state any exclusions or prerequisites. Usage is implied rather than prescribed.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources