Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

git_log

Display commit history with details including commit messages, authors, dates, and branch information to track code changes and project evolution.

Instructions

Show commit history with details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoRepository directory
limitNoNumber of commits to show
onelineNoShow one line per commit
graphNoShow commit graph
allNoShow all branches

Implementation Reference

  • Core handler function for git_log tool that builds git log command with customizable flags and executes it using the shared executeGitCommand helper.
    export async function gitLog(args: z.infer<typeof gitLogSchema>): Promise<ToolResponse> { const onelineFlag = args.oneline ? '--oneline' : '--pretty=format:"%H | %an | %ar | %s"'; const graphFlag = args.graph ? '--graph' : ''; const allFlag = args.all ? '--all' : ''; const limit = `-${args.limit}`; return executeGitCommand(`git log ${onelineFlag} ${graphFlag} ${allFlag} ${limit}`.trim(), args.cwd);
  • Zod validation schema for git_log tool inputs, used in the MCP dispatcher.
    export const gitLogSchema = z.object({ cwd: z.string().optional().describe('Repository directory'), limit: z.number().optional().default(10).describe('Number of commits to show'), oneline: z.boolean().optional().default(false).describe('Show one line per commit'), graph: z.boolean().optional().default(false).describe('Show commit graph'), all: z.boolean().optional().default(false).describe('Show all branches') });
  • src/index.ts:373-375 (registration)
    MCP CallToolRequest handler registration that routes git_log calls to the gitLog function after schema validation.
    if (name === 'git_log') { const validated = gitLogSchema.parse(args); return await gitLog(validated);
  • MCP tool metadata and JSON input schema for git_log, part of gitTools array returned by ListToolsRequest.
    { name: 'git_log', description: 'Show commit history with details', inputSchema: { type: 'object', properties: { cwd: { type: 'string', description: 'Repository directory' }, limit: { type: 'number', default: 10, description: 'Number of commits to show' }, oneline: { type: 'boolean', default: false, description: 'Show one line per commit' }, graph: { type: 'boolean', default: false, description: 'Show commit graph' }, all: { type: 'boolean', default: false, description: 'Show all branches' } } }
  • Utility function to execute git commands asynchronously, formats output as ToolResponse, used by all git tools including gitLog.
    async function executeGitCommand(command: string, cwd?: string): Promise<ToolResponse> { try { const { stdout, stderr } = await execAsync(command, { cwd: cwd || process.cwd(), shell: '/bin/bash', maxBuffer: 10 * 1024 * 1024 // 10MB buffer }); return { content: [ { type: "text" as const, text: JSON.stringify({ success: true, command: command, stdout: stdout.trim(), stderr: stderr.trim(), cwd: cwd || process.cwd() }, null, 2) } ] }; } catch (error: any) { return { content: [ { type: "text" as const, text: JSON.stringify({ success: false, command: command, stdout: error.stdout?.trim() || '', stderr: error.stderr?.trim() || error.message, exitCode: error.code || 1, cwd: cwd || process.cwd() }, null, 2) } ], isError: true }; }

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/ConnorBoetig-dev/mcp2'

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