Skip to main content
Glama

Create or update a snippet

wp_snippet_save

Create or update a WordPress PHP snippet by storing code with a target scope. Save it inactive, test it, then activate to run on the live site.

Instructions

Save a snippet. Omit id to create; pass id to update. Keep active=false, test with wp_snippet_run, then activate.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo
codeYesPHP without the opening <?php tag
nameYes
scopeNomanual
activeNo
priorityNo
descriptionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior3/5

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

Annotations are thin (only openWorldHint=true), so the description carries most of the burden. It usefully advises keeping new snippets inactive and testing before activation, which is real behavioral guidance, but says nothing about permissions, what an update does to existing snippet state, or reversibility of a mutation.

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, front-loaded sentences with zero filler. The create/update rule and the test-then-activate workflow are both stated before anything else.

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

Completeness3/5

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

No output schema exists and annotation coverage is minimal, so the description is the only source of behavioral context for a 7-parameter mutation tool. It covers the create/update distinction and activation safety, but is incomplete on the remaining parameters and on permissions or side effects.

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 only 14% (just the code param), so the description must compensate. It clarifies id (create vs update) and active (stay false), but leaves name, scope, priority, and description semantics to the schema, and doesn't explain the scope enum values.

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?

Specific verb+resource ("Save a snippet") with an explicit create/update discrimination keyed on the id parameter, so an agent knows exactly what the tool does. It names one sibling (wp_snippet_run) but doesn't distinguish itself from wp_snippet_list/delete beyond the operation name.

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?

Gives a concrete workflow: omit id to create, pass id to update, and the sequence "keep active=false, test with wp_snippet_run, then activate." This routes the agent to a sibling tool and states the safe path. No explicit when-not-to-use, but context is clear.

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