Skip to main content
Glama

Opus Growth, Ad Platforms MCP Connector

Edit WordPress Theme File

wordpress_theme_file
Destructive

Read and safely edit the ACTIVE THEME's own files on a connected WordPress site — the last resort for things baked into a theme PHP/CSS file that nothing else can reach: a Google tag hard-coded into header.php (a duplicate gtag the theme prints on every page), a wrong heading level in a template, a stray inline style. wordpress_option reaches plugin/theme SETTINGS and wordpress_snippet adds NEW PHP through WPCode, but neither can change a line the theme itself ships.

action: 'list' = the theme's source files with size and whether each is writable; 'get' (path) = one file's contents; 'edit' (path) = change it; 'restore' (path) = undo the last edit to that file. Scope is deliberately narrow and safe: only files INSIDE the active or parent theme folder, only .php/.css/.js/.html/.txt, no path escapes ('..' is refused), and only files that already exist (it never creates one). Pass path as list/get reports it — e.g. 'wp-content/themes/construction/header.php' or just 'header.php'.

edit has two modes. mode='remove_block' with contains='AW-851563016' removes every / block that contains that text — the clean way to strip a hard-coded gtag / GTM / Google Ads tag out of a theme file (find the id first with wordpress_tracking, which now detects AW- / G- / GT- ids in theme files as well). mode='replace' with find + replace makes a literal text change; count caps how many occurrences may match, and if find appears more times than that nothing is written, so you can make find more specific — this is how you turn an H4 into an H2. SAFETY on every edit: the whole file is backed up first, PHP files are re-checked with php -l and the write is AUTOMATICALLY REVERTED if it would break the syntax, and restore brings the previous version back. confirm=false previews (match count and size delta) without writing; confirm=true applies. Needs Connector 0.9.0 or newer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
findNo
modeNoreplace
pathNo
countNo
actionNolist
confirmNo
replaceNo
containsNo
site_urlNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. Added
  4. Removed
  5. Added
  6. Removed
  7. Added
  8. Removed
  9. Added
  10. Removed
  11. Added
  12. Removed
  13. Added
  14. Removed
  15. Added
  16. Removed
  17. Added
  18. Removed
  19. Added
  20. Removed
  21. Added
  22. Removed
  23. Added
  24. Removed
  25. Added
  26. Removed
  27. Added
  28. Removed
  29. Added
  30. Removed
  31. Added
  32. Removed
  33. Added
  34. Removed
  35. Added
  36. Removed
  37. Added
  38. Removed
  39. Added

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructive/write behavior, but the description adds substantial context beyond them: whole-file backup before every edit, `php -l` syntax re-check with automatic revert, restore semantics, confirm=false preview vs confirm=true apply, and the narrow scope rules (theme folder only, specific extensions, no '..' escapes, never creates files).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and scope are front-loaded, and the action-mode-safety ordering is logical. The prose is dense and lengthy, with some sentences carrying several ideas at once, but for a 9-param mutating tool most of the content earns its place.

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?

Given a write tool with 9 params, zero schema descriptions, and an output schema already handling return values, the description covers scope, actions, edit modes, safety/revert behavior, and preview semantics. Nothing essential for correct invocation appears missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must carry the load, and it largely does: action values, path format with concrete examples, mode values, contains/find/replace semantics, and count's abort-if-exceeded behavior are all spelled out. Minor gap: site_url is never addressed, and defaults aren't noted.

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?

States a specific verb+resource ('Read and safely edit the ACTIVE THEME's own files') and immediately scopes it as a last-resort capability. It explicitly distinguishes itself from wordpress_option (plugin/theme settings) and wordpress_snippet (new PHP via WPCode), so an agent can route correctly without opening other schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly frames when to use it ('the last resort for things baked into a theme file that nothing else can reach') and why siblings can't cover that case. It then documents each action value (list/get/edit/restore) and, for edit, which mode to pick for which scenario (strip a gtag via remove_block, turn H4 into H2 via replace).

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.