Skip to content
New site — Virtual Media Folders now has its own home.Visit vmf.soderlind.no →

Rules Engine Abilities

These abilities are active when the vmfa-rules-engine add-on is installed and active (VMFA_RULES_ENGINE_VERSION defined).

Category slug: vmfo-rules-engine
REST namespace: vmfa-rules/v1


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

Returns all folder-assignment rules ordered by priority.

No parameters.

An array of rule objects:

[
{
"id": "abc123",
"name": "Invoices",
"folder_id": 55,
"conditions": [
{ "type": "filename", "operator": "contains", "value": "invoice" }
],
"enabled": true,
"priority": 10,
"description": "Route invoice PDFs to the Invoices folder."
}
]
Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "username: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-rules/list-rules", "parameters": {} }
}
}'

Label: Create Rule
Permission: manage_options
Flags: —

Creates a new folder-assignment rule.

Parameter Type Required Default Description
name string (min 1) Yes — Rule display name
folder_id integer ≥ 1 Yes — Target folder term ID
conditions array Yes — Array of condition objects (see below)
enabled boolean No true Whether the rule runs automatically
priority integer ≥ 1 No — Evaluation order; lower = evaluated first
description string No — Human-readable description

Condition object:

{ "type": "filename|mimetype|title|alt", "operator": "contains|equals|starts_with|ends_with", "value": "..." }

The created rule object (same shape as list-rules items).

Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "username: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-rules/create-rule",
"parameters": {
"name": "Invoices",
"folder_id": 55,
"conditions": [
{ "type": "filename", "operator": "contains", "value": "invoice" }
],
"priority": 10
}
}
}
}'

Label: Update Rule
Permission: manage_options
Flags: idempotent

Updates an existing rule. Only the fields you supply are changed.

Parameter Type Required Default Description
rule_id string Yes — Rule ID to update (from list-rules)
name string No — New display name
folder_id integer ≥ 1 No — New target folder
conditions array No — Replacement condition list
enabled boolean No — Enable or disable the rule
priority integer ≥ 1 No — New priority
description string No — New description

The updated rule object.

Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "username: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-rules/update-rule",
"parameters": { "rule_id": "abc123", "enabled": false }
}
}
}'

Label: Delete Rule
Permission: manage_options
Flags: destructive

Permanently deletes a folder-assignment rule. Existing media assignments are not changed.

Parameter Type Required Description
rule_id string Yes Rule ID to delete
{ "deleted": true, "rule_id": "abc123" }
Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "username: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-rules/delete-rule",
"parameters": { "rule_id": "abc123" }
}
}
}'

Label: Preview Rule Matches
Permission: upload_files
Flags: readonly

Simulates which media items would be assigned by a rule (or all enabled rules) without making any changes.

Parameter Type Required Default Description
rule_id string No — Preview a specific rule; omit to preview all enabled rules
unassigned_only boolean No true Limit preview to media not yet in any folder
limit integer No 50 Max items to return
offset integer No 0 Pagination offset
{
"total_count": 120,
"matched": 14,
"unmatched": 106,
"items": [ { "attachment_id": 1001, "title": "invoice_jan.pdf", "matched_rule_id": "abc123", "target_folder_id": 55 } ],
"rule_id": "abc123"
}
Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "username: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-rules/preview",
"parameters": { "rule_id": "abc123", "unassigned_only": true }
}
}
}'

Label: Apply Rules
Permission: manage_options
Flags: —

Applies all enabled rules to existing media, assigning items to their target folders. This is the batch-run equivalent of the automatic rule engine that runs on upload.

Parameter Type Required Default Description
rule_id string No — Apply only this rule; omit to apply all enabled rules
unassigned_only boolean No true Only process media not already in a folder
{
"processed": 120,
"assigned": 14,
"skipped": 106
}
Terminal window
curl -s -X POST "https://example.com/wp-json/mcp/mcp-adapter-default-server" \
-u "username: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-rules/apply",
"parameters": { "unassigned_only": true }
}
}
}'