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); }

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