Skip to main content
Glama

stash_restore

Restore interrupted work by applying a stash entry via its SHA, keeping the stash intact for retry or abort. Refuses dirty worktrees to avoid mixing sets of half-finished changes.

Instructions

Put interrupted work back. Applied by sha rather than by position, and the stash entry is applied rather than dropped — so a restore that conflicts can be retried or abandoned without the work having evaporated. Refuses if the target worktree is already dirty: stacking a stash on top mixes two sets of half-finished work with no way to separate them afterwards.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
cwdNoDirectory identifying the project and the tree. Defaults to this session's working directory, which in a git worktree is that worktree.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/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 of behavioral disclosure, and it does so excellently. It explains that the stash is applied rather than dropped, that conflicts can be retried or abandoned without losing work, and that dirty worktrees are rejected with a clear rationale. This is far beyond what the schema alone provides.

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 three purposeful sentences with no wasted words. The core action is front-loaded, and the behavioral and safety details are presented efficiently with a clear rationale. Every sentence earns its place.

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 lack of annotations and output schema, the description is nearly complete: it covers the operation, non-destructive behavior, conflict handling, and dirty-worktree refusal. The main gap is explicit documentation of the required id parameter—how it should be obtained and formatted—so an agent might still be uncertain about the exact value to pass.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The id parameter has no schema description, and the description only indirectly addresses it by saying the stash entry is 'applied by sha rather than by position.' This adds useful meaning but does not explicitly map 'sha' to the integer id parameter, and the wording is potentially confusing given id's integer type. The cwd parameter is already well described in 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 identifies the action ('Put interrupted work back'), the resource ('stash entry'), and the key distinguishing mechanism ('applied by sha rather than by position'). It is readily distinguishable from the only sibling tool, stash_list, because it describes restoration rather than listing.

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 for when to use the tool: restoring stashed work back into a worktree. It also gives an explicit refusal condition ('Refuses if the target worktree is already dirty') and explains why. However, it does not name alternatives, such as stash_list for finding the relevant id, so it stops short of a 5.

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