Skip to main content
Glama

status

Retrieve the current status of a Git repository, including staged changes, untracked files, branch details, and stash information, using customizable parameters for detailed or concise output.

Instructions

Get the current git repository status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aheadBehindNoDisplay detailed ahead/behind counts relative to upstream branch (--ahead-behind, --no-ahead-behind)
branchNoShow the branch and tracking info even in short-format (-b, --branch)
columnNoDisplay untracked files in columns (--column[=<options>], --no-column)
findRenamesNoTurn on rename detection, optionally set similarity threshold (--find-renames[=<n>])
ignoreSubmodulesNoIgnore changes to submodules (--ignore-submodules[=<when>])
ignoredNoShow ignored files as well (--ignored[=<mode>])
longNoGive the output in the long-format (--long, default)
pathspecNoLimit the output to the given paths
renamesNoTurn on/off rename detection (--renames, --no-renames)
repoPathYesAbsolute path to the git repository
shortNoGive the output in the short-format (-s, --short)
showStashNoShow the number of entries currently stashed away (--show-stash)
untrackedFilesNoShow untracked files (-u[<mode>], --untracked-files[=<mode>])
verboseNoShow textual changes that are staged to be committed (-v, --verbose, can be specified twice)

Implementation Reference

  • The core handler function (#handle) that executes the git status command using simple-git, checks if it's a repo, and returns the status as JSON.
    readonly #handle: ToolCallback<typeof GIT_STATUS_INPUT_SCHEMA> = async (input) => { const sg = simpleGit(input.repoPath); const isRepo = await sg.checkIsRepo(); if (!isRepo) { return { isError: true, content: [ { type: 'text', text: 'Not a git repository', }, ], }; } const status = await sg.status(this.inputToOptions(input)); return { content: [ { type: 'text', text: 'Git status retrieved successfully', }, { type: 'text', text: JSON.stringify(status), }, ], }; };
  • Zod input schema (GIT_STATUS_INPUT_SCHEMA) defining all parameters for the git status tool, mirroring git status options.
    export const GIT_STATUS_INPUT_SCHEMA = { repoPath: z.string().describe('Absolute path to the git repository'), short: z.boolean().optional().describe('Give the output in the short-format (-s, --short)'), branch: z.boolean().optional().describe('Show the branch and tracking info even in short-format (-b, --branch)'), showStash: z.boolean().optional().describe('Show the number of entries currently stashed away (--show-stash)'), long: z.boolean().optional().describe('Give the output in the long-format (--long, default)'), verbose: z .union([z.boolean(), z.number().int().min(0).max(2)]) .optional() .describe('Show textual changes that are staged to be committed (-v, --verbose, can be specified twice)'), untrackedFiles: z .union([z.boolean(), z.enum(['no', 'normal', 'all'])]) .optional() .describe('Show untracked files (-u[<mode>], --untracked-files[=<mode>])'), ignoreSubmodules: z .enum(['none', 'untracked', 'dirty', 'all']) .optional() .describe('Ignore changes to submodules (--ignore-submodules[=<when>])'), ignored: z .union([z.boolean(), z.enum(['traditional', 'no', 'matching'])]) .optional() .describe('Show ignored files as well (--ignored[=<mode>])'), aheadBehind: z .boolean() .optional() .describe('Display detailed ahead/behind counts relative to upstream branch (--ahead-behind, --no-ahead-behind)'), renames: z.boolean().optional().describe('Turn on/off rename detection (--renames, --no-renames)'), findRenames: z .union([z.boolean(), z.number().int().min(0).max(100)]) .optional() .describe('Turn on rename detection, optionally set similarity threshold (--find-renames[=<n>])'), column: z .union([z.boolean(), z.string()]) .optional() .describe('Display untracked files in columns (--column[=<options>], --no-column)'), pathspec: z.array(z.string()).optional().describe('Limit the output to the given paths'), };
  • The register method of GitStatusTool that calls srv.registerTool with the tool name 'status', config, and handler.
    register(srv: McpServer) { srv.registerTool(this.name, this.config, this.#handle); }
  • Instantiation and registration of the GitStatusTool on the MCP server.
    new GitStatusTool().register(server);
  • Getter that returns the tool name as 'status'.
    get name() { return 'status'; }

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/ver0-project/mcps'

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