Skip to content

Media Cleanup Abilities

These abilities are active when the vmfa-media-cleanup add-on is installed and active (VMFA_MEDIA_CLEANUP_VERSION defined).

Category slug: vmfo-media-cleanup
REST namespace: vmfa-cleanup/v1

Typical workflow: get-statsstart-scan → poll get-scan-statuslist-resultsarchive / trash / delete.


Label: Start Cleanup Scan
Permission: manage_options
Flags:

Starts a background scan that analyses media for unused files, duplicates, and oversized images. Only one scan can run at a time.

ParameterTypeRequiredDefaultDescription
typesstring[]Noall typesSubset of ["unused", "duplicate", "oversized"] to scan
{ "status": "running", "started_at": "2026-05-02T10:00:00Z" }
Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {
"name": "mcp-adapter-execute-ability",
"arguments": {
"ability_name": "vmfo-cleanup/start-scan",
"parameters": { "types": ["unused", "duplicate"] }
}
}
}'

Label: Get Scan Status
Permission: upload_files
Flags: readonly · idempotent

Returns the current progress of the running or last-completed cleanup scan.

No parameters.

{
"status": "running",
"phase": "duplicates",
"total": 500,
"processed": 210,
"started_at": "2026-05-02T10:00:00Z",
"completed_at": null,
"types": ["unused", "duplicate"]
}

status values: idle · running · completed · cancelled · failed

Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {
"name": "mcp-adapter-execute-ability",
"arguments": { "ability_name": "vmfo-cleanup/get-scan-status", "parameters": {} }
}
}'

Label: Cancel Scan
Permission: manage_options
Flags: idempotent

Cancels the currently running scan. Safe to call when no scan is running.

No parameters.

{ "cancelled": true }
Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {
"name": "mcp-adapter-execute-ability",
"arguments": { "ability_name": "vmfo-cleanup/cancel-scan", "parameters": {} }
}
}'

Label: Get Cleanup Stats
Permission: upload_files
Flags: readonly · idempotent

Returns dashboard-level statistics from the last completed scan.

No parameters.

{
"total_media": 1240,
"unused_count": 87,
"duplicate_count": 34,
"duplicate_groups": 12,
"oversized_count": 5,
"flagged_count": 126
}
Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {
"name": "mcp-adapter-execute-ability",
"arguments": { "ability_name": "vmfo-cleanup/get-stats", "parameters": {} }
}
}'

Label: List Results
Permission: upload_files
Flags: readonly · idempotent

Returns paginated scan results filterable by type.

ParameterTypeRequiredDefaultDescription
typestringNounused · duplicate · oversized · flagged · trash
pageinteger ≥ 1No1Page number
per_pageinteger 1–100No20Items per page
{
"items": [
{ "id": 1001, "title": "old-banner.png", "url": "...", "type": "unused", "file_size": 204800 }
],
"total": 87,
"page": 1,
"per_page": 20,
"total_pages": 5
}
Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {
"name": "mcp-adapter-execute-ability",
"arguments": {
"ability_name": "vmfo-cleanup/list-results",
"parameters": { "type": "unused", "per_page": 20 }
}
}
}'

Label: Archive Media
Permission: manage_categories
Flags: idempotent

Moves media items to an archive folder. Reversible — items can be moved back.

ParameterTypeRequiredDescription
attachment_idsinteger[] (min 1, unique)YesAttachment IDs to archive
{ "archived": 3, "failed": 0 }
Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {
"name": "mcp-adapter-execute-ability",
"arguments": {
"ability_name": "vmfo-cleanup/archive",
"parameters": { "attachment_ids": [1001, 1002, 1003] }
}
}
}'

Label: Trash Media
Permission: manage_options
Flags: destructive · idempotent

Moves media items to the WordPress trash. Items can be restored from the trash within the configured retention period.

ParameterTypeRequiredDescription
attachment_idsinteger[] (min 1, unique)YesAttachment IDs to trash
{ "trashed": 3, "failed": 0 }
Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {
"name": "mcp-adapter-execute-ability",
"arguments": {
"ability_name": "vmfo-cleanup/trash",
"parameters": { "attachment_ids": [1001, 1002] }
}
}
}'

Label: Permanently Delete Media
Permission: manage_options
Flags: destructive

Permanently deletes media items and their files from disk. This action cannot be undone. Prefer trash unless you are certain.

ParameterTypeRequiredDescription
attachment_idsinteger[] (min 1, unique)YesAttachment IDs to permanently delete
{ "deleted": 2, "failed": 0 }
Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {
"name": "mcp-adapter-execute-ability",
"arguments": {
"ability_name": "vmfo-cleanup/delete",
"parameters": { "attachment_ids": [1001] }
}
}
}'