Skip to main content
Glama

show

View detailed commit information and changes in a Git repository. Specify format, paths, or file status to customize output.

Instructions

Display commit details and changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commitNoCommit hash, branch, or tag to show (defaults to HEAD)
formatNoPretty-print format for commit
nameOnlyNoShow only names of changed files (--name-only)
nameStatusNoShow names and status of changed files (--name-status)
pathspecNoLimit show to specific paths
repoPathYesAbsolute path to the git repository
statNoShow diffstat (--stat)

Implementation Reference

  • The private #handle method implements the core logic of the 'show' tool. It validates the repo, constructs git show arguments based on input, executes using simple-git, and returns the result as text content.
    readonly #handle: ToolCallback<typeof GIT_SHOW_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 args: string[] = []; if (input.format) { args.push(`--pretty=${input.format}`); } if (input.nameOnly) { args.push('--name-only'); } if (input.nameStatus) { args.push('--name-status'); } if (input.stat) { args.push('--stat'); } const commit = input.commit ?? 'HEAD'; args.push(commit); if (input.pathspec && input.pathspec.length > 0) { args.push('--', ...input.pathspec); } const result = await sg.show(args); return { content: [ { type: 'text', text: result || `No information found for ${commit}`, }, ], }; };
  • GIT_SHOW_INPUT_SCHEMA defines the Zod input schema for the 'show' tool, including repoPath, commit, format, and various flags.
    export const GIT_SHOW_INPUT_SCHEMA = { repoPath: z.string().describe('Absolute path to the git repository'), commit: z.string().optional().describe('Commit hash, branch, or tag to show (defaults to HEAD)'), format: z .enum(['oneline', 'short', 'medium', 'full', 'fuller', 'email', 'raw']) .optional() .describe('Pretty-print format for commit'), nameOnly: z.boolean().optional().describe('Show only names of changed files (--name-only)'), nameStatus: z.boolean().optional().describe('Show names and status of changed files (--name-status)'), stat: z.boolean().optional().describe('Show diffstat (--stat)'), pathspec: z.array(z.string()).optional().describe('Limit show to specific paths'), };
  • new GitShowTool().register(server); registers the 'show' tool with the MCP server.
    new GitShowTool().register(server);
  • The register method on GitShowTool calls srv.registerTool(this.name, this.config, this.#handle) to register the tool.
    register(srv: McpServer) { srv.registerTool(this.name, this.config, this.#handle); }
  • The name getter returns 'show', defining the tool's name.
    get name() { return 'show'; }

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