Skip to main content
Glama

Delete a theme file

delete_theme_file
Destructive

Remove a file from a WordPress theme draft while protecting your live theme. Prevents accidental breakage by refusing to modify active themes unless explicitly allowed.

Instructions

Delete a file from a theme draft. Refuses to touch a live active theme unless explicitly allowed. Deleting a required template (index.php, style.css) breaks the theme.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath relative to the theme root.
themeNoTheme stylesheet or draft id.
confirmNoRequired — the file is removed from the server.
site_idNoWhich configured WordPress site to act on. Optional — with a single site configured it is used automatically; with several, the default site is used unless you name one. Run list_sites for valid ids.
allow_live_themeNoPermit acting on the live active theme. Use a draft instead.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.0.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
  2. First observedv1.0.0

TDQS

A4.4/5.0
Behavior5/5

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

Beyond the destructiveHint annotation, the description adds valuable behavioral detail: it refuses to operate on live active themes without explicit permission, and it warns that deleting required templates like index.php or style.css breaks the theme. This helps an agent anticipate important consequences before invoking the tool.

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 tight sentences with no filler: the first states the operation, the second states the safety guardrail, and the third states the key risk. All information is front-loaded and earns its place.

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 tool with no output schema, the description covers the core action, the safety constraint, and the most important risk. While it doesn't describe response behavior or explicitly say 'permanent,' the destructiveHint annotation, high schema coverage, and confirm parameter description make the tool well-specified overall.

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 100%, so every parameter is already documented in the schema. The description does not add parameter-specific semantics beyond broad behavioral context, so the baseline of 3 is appropriate because the schema carries the weight.

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?

The description states a specific action ('Delete'), a specific resource ('a file from a theme draft'), and distinguishes itself from live-theme operations by noting that live active themes are refused unless explicitly allowed. This clearly separates it from sibling tools like read_theme_file, write_theme_file, and edit_theme_file.

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?

The description gives clear context: use it on draft themes, and it will not touch a live active theme unless allow_live_theme is explicitly set. It does not explicitly name sibling alternatives, but the draft-vs-live guidance is sufficient for an agent to select this tool over related theme-file tools in most cases.

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

Deploy Server

Other Tools