Skip to main content
Glama

wp_insert_shortcode

Insert HTML or shortcodes before or after a specific shortcode tag on a WordPress page, with dry-run preview to verify placement before saving.

Instructions

Insert new content before or after an existing shortcode in a page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dry_runNoPreview changes without writing
page_idYesPage ID
positionYes
anchor_tagYesAnchor shortcode tag
occurrenceNoZero-based occurrence after anchor filtering
new_contentYesShortcode or HTML to insert
anchor_match_attrNoAttribute used to disambiguate
anchor_match_valueNoRequired attribute substring

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?

There are no annotations, so the description must carry the full burden of behavioral disclosure. It states that content is inserted before or after an existing shortcode, but it does not mention side effects, failure behavior when the anchor is missing, the meaning of occurrence, or whether dry_run prevents writes.

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?

The description is a single sentence with no filler and the core action is front-loaded. It is appropriately concise for what it communicates.

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 write operation with no annotations and no output schema, yet the description only covers the basic insertion action. It lacks context about return values, error conditions, ambiguous anchors, and the effect of occurrence or attribute matching, so an agent is under-informed before invoking it.

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 high (88%), so the baseline is 3. The description adds little parameter-specific meaning beyond what the schema already provides, though it does implicitly map to new_content, anchor_tag, and position.

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 clearly names a specific action ('Insert'), a specific target ('existing shortcode'), and a scope ('in a page'). It is easy to tell apart from sibling tools like wp_replace_shortcode, but it does not explicitly call out that distinction.

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?

The description gives no guidance on when to choose this tool over alternatives like wp_replace_shortcode or wp_elementor_update_shortcode_content. It also omits prerequisites, such as the requirement that the anchor shortcode already exists in the page.

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