Skip to main content
Glama

apply_plan

Executes a saved cleanup plan by plan ID, re-verifying each action before archiving empty files, duplicates, or orphan attachments; stale actions are skipped and nothing is permanently deleted.

Instructions

Execute a cleanup plan created by plan_cleanup, by its plan ID. Archives each action in the plan (empty files, duplicate files, orphan attachments) after re-verifying it; nothing is ever permanently deleted. Before executing, each action is re-verified against the library: the path must still exist, the SHA-256 and modification time must match the plan, and the reason must still hold (empty file still empty, duplicate group still intact, orphan still unreferenced). Actions that no longer hold are skipped with the reason, and the rest still execute. Plans older than 7 days are rejected. A plan ID that does not exist or is malformed is reported, and nothing is changed. The search index is refreshed incrementally after execution, so the next search reflects the change. A plan that has been executed is retired; running it again reports that it was already applied. Use this when the user asks to execute a plan in chat (for example "执行这个清理计划"). The command-line memdrive-mcp apply <plan-id> does the same thing from a terminal. Never call this tool automatically right after plan_cleanup. Always show the user the plan preview and plan ID first and wait for their explicit confirmation in the chat before calling.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "plan_id": "<plan_id>"
    },
    "name": "apply_plan"
  }
}

Input Schema

NameRequiredDescriptionDefault
plan_idYesPlan ID returned by plan_cleanup (for example "20261114054412-c4ad79").

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.9.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the whole burden and does so: it discloses that actions are archived not deleted, that each action is re-verified (path existence, SHA-256, mtime, reason) and skipped if stale, that 7-day-old plans are rejected, that malformed IDs change nothing, that the search index refreshes, and that plans are retired after execution. These are exactly the mutation-safety traits an agent needs.

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 side-effect guarantee, then layers verification, error handling, and usage rules in a logical order. It is on the long side and the verification paragraph could be tightened, but no sentence 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?

For a single-parameter mutation tool with no output schema and no annotations, the description covers side effects, failure modes, idempotency, staleness, and post-execution index behavior. An agent has everything needed to call it correctly and safely.

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 100% and already includes a format example, so the schema does most of the work. The description adds meaning beyond it by explaining that a nonexistent or malformed plan ID is reported with nothing changed, which tells the agent how to interpret a bad argument.

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?

Opens with a specific verb+resource+scope: "Execute a cleanup plan created by plan_cleanup, by its plan ID," and immediately names the specific action types it handles (empty files, duplicate files, orphan attachments). It clearly distinguishes itself from plan_cleanup, which creates the plan.

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?

States explicitly when to use it ("when the user asks to execute a plan in chat"), names a terminal alternative, and gives a hard negative rule: never call automatically after plan_cleanup, always show the preview and wait for explicit confirmation. This is the strongest possible guidance with a named exclusion.

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