Skip to main content
Glama

Delete media

wp_delete_media
Destructive

Delete one file of the media library (attachment) for good: its entry and metadata are removed, and WordPress deletes the file and its image sizes on the server (a file the server does not let it delete stays, without an error). The media library has no trash here. It is removed as featured image wherever it was one; posts that embed or link it keep its old URL. Needs the right to delete that file. Returns {deleted: true, id}; an id that no longer exists returns a not-found error. Posts and pages are deleted with wp_delete_post. Forwarded by AlphaBridge Connect to the one site this connection reaches.

Input Schema

NameRequiredDescriptionDefault
idYesAttachment id of the file to delete.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / id / description
      Added value: +"Attachment id of the file to delete."
  2. Added

TDQS

A4.4/5.0
Behavior5/5

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

Adds substantial context beyond the destructiveHint annotation: no trash, the physical file and derived image sizes are removed, featured-image assignments are cleared, embedding posts keep stale URLs, a delete-permission is required, and a file the server refuses to delete is left silently. That silent-failure caveat is exactly the kind of trait annotations cannot express.

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?

Front-loaded with the core action and its permanence before the caveats, and nearly every clause carries real information. It is on the dense side — several clauses are packed into long sentences — but nothing is filler.

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?

With no output schema, the description correctly spells out the return value ({deleted: true, id}) and the not-found error path, and it covers side effects, permissions, and failure modes. An agent has everything needed to call it safely.

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% and there is a single integer parameter already documented as 'Attachment id of the file to delete.' The description adds only the behavioral consequence of a nonexistent id (not-found error), not new meaning about the parameter itself, so baseline 3 applies.

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 and resource ('Delete one file of the media library (attachment)') with explicit scope — a single attachment, permanently. It also names the sibling it is not ('Posts and pages are deleted with wp_delete_post'), so an agent can distinguish it from the ~100 other delete tools without opening a schema.

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?

Clearly routes post/page deletion to wp_delete_post and implies this tool is only for media-library attachments. It does not explicitly distinguish itself from wp_delete_upload_file, which sits right next to it in the sibling list, so one exclusion is left to inference.

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.

Resources