Skip to main content
Glama
saitolume

git-mcp-server

by saitolume

git-mcp-server: Restore worktree paths

git_restore_worktree
Destructive

Restore specific tracked worktree paths from the current index after validating a snapshot guard, ensuring safe and idempotent restoration.

Instructions

Operation: Restore declared tracked worktree paths from the current index after validating the supplied snapshot guard. Returns: request_id, repository_id, restored paths, and a new worktree_snapshot_id. Defaults: all inputs are required and the current index is the only content source. Excludes: index mutation, untracked paths or deletion, directories, globs, and unrequested paths.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYesExplicit tracked worktree paths to restore from the current index after the snapshot guard is validated.
repositoryYesAbsolute path to the exact target Git worktree for this mutation.
request_idYesClient-generated UUID that makes this mutation durable and idempotent for exact replay.
expected_headYesExact current local HEAD object ID expected before mutation; mismatch rejects without Git mutation.
expected_branchYesExact current local branch name expected before mutation; mismatch rejects without Git mutation.
worktree_snapshot_idYesExact complete worktree snapshot guard previously returned by git_status.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNo
errorNo
statusYes
warningsYes
operationYes
request_idNo
repository_idNo
observed_afterNo
observed_beforeNo
Behavior5/5

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

Annotations indicate destructiveHint=true, and the description goes beyond by detailing what is restored (tracked worktree paths), what is validated (snapshot guard), what is excluded (index mutation, untracked paths, deletion, etc.), and what is returned. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, using only three short sentences structured as Operation, Returns, Defaults, and Excludes. Every sentence adds essential information with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 required parameters, destructive, snapshot guard requirement), the description covers purpose, return fields, defaults, and exclusions. With an output schema available, it is nearly complete, though it could briefly mention typical usage scenarios (e.g., after a conflict resolution) for full clarity.

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?

All 6 parameters have schema descriptions (100% coverage), so the baseline is 3. The description adds value by stating 'all inputs are required' and 'the current index is the only content source,' providing operational context beyond the schema.

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?

The description clearly states the tool restores 'declared tracked worktree paths from the current index' after validating a snapshot guard, using specific verbs and resources. It distinguishes from siblings by focusing on worktree restoration, unlike git_add, git_commit, or git_merge.

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?

The description provides clear context: the operation requires a validated snapshot guard and only works on tracked paths from the index. It lists exclusions (index mutation, untracked paths, etc.) to help decide when not to use, but does not explicitly name alternatives or when to prefer this over siblings.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/saitolume/git-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server