Skip to main content
Glama

files_restore

Restore a file's on-disk content from a specific git commit hash and re-index full-text search to undo accidental edits or recover a known-good version.

Instructions

DESTRUCTIVE. Overwrite a file's current on-disk content with the version recorded at a specific git commit, then re-index FTS. The hash MUST come from files_get_history for THIS file (foreign hashes throw). The current uncommitted content is lost unless it was already committed elsewhere. The file watcher may also pick up the change before this returns. No external auth or rate limits. Returns {file_id, path, hash, success, message}. Use only to undo accidental edits or recover a known-good version.

Input Schema

NameRequiredDescriptionDefault
hashYesCommit hash to restore from (from get_history)
file_idYesID of the file

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv6.1.2

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 full burden and delivers: DESTRUCTIVE, uncommitted content is lost, a file-watcher race condition may apply, no external auth or rate limits, and the exact return shape. This is unusually complete behavioral disclosure for a mutation tool.

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?

Dense but front-loaded with the DESTRUCTIVE warning, and every sentence carries distinct information (precondition, data-loss, race, auth, return shape, scope). It reads as a compact block rather than flowing prose, 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?

No output schema and no annotations exist, yet the description supplies the return shape, the safety profile, the prerequisite, and the destructive consequences. An agent has everything needed to invoke it correctly without guessing.

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%, so the baseline is 3, but the description adds real semantic constraints beyond the schema: hash must originate from files_get_history for this specific file, and foreign hashes throw. That constraint meaningfully changes how the agent sources the parameter.

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 (overwrite on-disk content with a git-commit version), names the follow-on effect (re-index FTS), and distinguishes itself from siblings like files_update, files_delete, and files_get_history. An agent can tell exactly what this does without opening the schema.

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?

Explicitly scopes the use case ('Use only to undo accidental edits or recover a known-good version') and states a hard prerequisite: the hash MUST come from files_get_history for THIS file, with foreign hashes throwing. It routes the agent to the correct sibling for obtaining the input.

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