Skip to main content
Glama

stash_list

Retrieve a list of Git stashes from a specified repository path using the Git MCP Server. Supports absolute paths for seamless repository access and management.

Instructions

List stashes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoPath to repository. MUST be an absolute path (e.g., /Users/username/projects/my-repo)

Implementation Reference

  • The core handler function that executes the `git stash list` command within the specified repository path, handles caching, validation, and error handling, and returns the list of stashes as a GitToolResult.
    static async stashList(options: BasePathOptions, context: GitToolContext): Promise<GitToolResult> {
      const path = this.getPath(options);
      return await this.executeOperation(
        context.operation,
        path,
        async () => {
          const { path: repoPath } = PathValidator.validateGitRepo(path);
          const result = await CommandExecutor.executeGitCommand(
            'stash list',
            context.operation,
            repoPath
          );
    
          const output = result.stdout.trim();
          return {
            content: [{
              type: 'text',
              text: output || 'No stashes found'
            }]
          };
        },
        {
          useCache: true,
          stateType: RepoStateType.STASH,
          command: 'stash list'
        }
      );
    }
  • Registers the 'stash_list' tool with the MCP server in the ListTools response, defining its name, description, and input schema.
    {
      name: 'stash_list',
      description: 'List stashes',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: `Path to repository. ${PATH_DESCRIPTION}`,
          },
        },
        required: [],
      },
    },
  • The switch case dispatcher in the tool executor that validates arguments using isPathOnly and calls the GitOperations.stashList handler.
    case 'stash_list': {
      const validArgs = this.validateArguments(operation, args, isPathOnly);
      return await GitOperations.stashList(validArgs, context);
    }
  • Type definition for BasePathOptions used as the input type for stash_list tool.
    export interface BasePathOptions {
      /**
       * MUST be an absolute path to the repository
       * Example: /Users/username/projects/my-repo
       * If not provided, will use GIT_DEFAULT_PATH from environment
       */
      path?: string;
    }
  • Type guard function isPathOnly used to validate input arguments for path-only tools like stash_list.
    export function isPathOnly(obj: any): obj is BasePathOptions {
      return obj && validatePath(obj.path);
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'List stashes' implies a read-only operation, but it doesn't specify what information is returned (e.g., stash IDs, messages, dates), whether it requires Git repository access, or if there are any limitations (e.g., only shows local stashes). This leaves key behavioral traits unclear.

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?

The description 'List stashes' is extremely concise at two words, with zero wasted language. It's front-loaded and to the point, making it easy to scan. However, it may be overly terse, risking under-specification, but it earns high marks for efficiency within the conciseness dimension.

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

Completeness2/5

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

Given the complexity (a Git-related tool with siblings like 'stash_pop'), no annotations, no output schema, and a simple input schema, the description is incomplete. It doesn't explain what 'stashes' are, what the output looks like, or how it fits into the broader toolset. For a tool in a Git context, more context is needed to be fully helpful.

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 input schema has 100% description coverage, with the 'path' parameter well-documented as an absolute path to a repository. The description adds no additional meaning beyond this, as it doesn't mention parameters at all. According to the rules, with high schema coverage (>80%), the baseline is 3, which is appropriate here since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List stashes' clearly states the verb ('List') and resource ('stashes'), making the basic purpose understandable. However, it lacks specificity about what 'stashes' are in this context (e.g., Git stashes) and doesn't distinguish it from sibling tools like 'stash_pop' or 'stash_save', which are related but different operations. This makes it vague in differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a repository path), exclusions, or comparisons to siblings like 'stash_pop' (which retrieves stashes) or 'status' (which might show stash status). Without such context, users must infer usage from the name alone.

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

Related 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/Sheshiyer/git-mcp-v2'

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