Skip to main content
Glama

wp_replace_shortcode

Replace a specific shortcode on a WordPress page with new content. Optionally filter by attribute and preview changes before applying.

Instructions

Find a specific shortcode in a page and replace it with new content. Optionally match an attribute value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tagYesShortcode tag to find
dry_runNoPreview changes without writing
page_idYesPage ID
match_attrNoAttribute used to disambiguate
occurrenceNoZero-based occurrence after tag/attribute filtering
match_valueNoRequired substring in the attribute
new_shortcodeYesFull replacement shortcode string

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv1.3.0

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description carries the full burden, but it only discloses that the tool replaces content and may filter by attribute. It does not state what happens to the original shortcode, whether changes are reversible, required permissions, failure behavior when no match is found, or that dry_run can preview the change.

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?

A single, front-loaded sentence with no filler. It states the core action immediately and adds the optional matching behavior in a second clause. Every word contributes.

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

Completeness2/5

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

This is a mutating tool with 7 parameters, no annotations, and no output schema. The description is too sparse to fully support invocation: it omits expected return values, error cases, permission requirements, and how occurrence/disambiguation rules affect the operation, though the schema does fill in some parameter details.

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 the baseline is 3. The description adds minimal context by tying 'specific shortcode' to the tag parameter and 'optionally match an attribute value' to match_attr/match_value, but most parameter meaning already exists in the 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?

The description states a clear verb ('replace') and resource ('specific shortcode in a page'), and the optional attribute matching adds precision. It is distinguishable from sibling tools like wp_insert_shortcode or wp_list_shortcodes, though it does not explicitly name alternatives such as wp_elementor_update_shortcode_content.

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 guidance about when to use this tool versus alternatives like wp_insert_shortcode, wp_elementor_update_shortcode_content, or wp_blocks_replace. The description implies a use case ('specific shortcode', 'optionally match attribute value') but never states exclusions or selection criteria.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/leonardobora/mcp-wordpress'

If you have feedback or need assistance with the MCP directory API, please join our Discord server