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
        };
      }
Behavior2/5

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

No annotations are provided, so the description carries full burden. 'Show commit history with details' implies a read-only operation, but it doesn't disclose behavioral traits like whether it requires git authentication, how it handles large histories (e.g., pagination), what format the output takes, or if it's safe to run in any repository state. For a tool with 5 parameters and no annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Show commit history with details'). There is zero wasted verbiage or redundancy, making it easy for an agent to parse quickly. Every word earns its place.

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 tool's moderate complexity (5 parameters, no output schema, no annotations), the description is incomplete. It doesn't explain the output format, behavioral constraints, or usage context, leaving the agent to guess based on the schema alone. For a git tool with multiple configuration options, more guidance 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?

Schema description coverage is 100%, with all 5 parameters well-documented in the schema (e.g., 'cwd' as 'Repository directory', 'limit' with default 10). The description adds no parameter-specific information beyond implying general 'details' in the output. According to guidelines, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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

Purpose4/5

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

The description 'Show commit history with details' clearly states the verb ('Show') and resource ('commit history'), making the purpose immediately understandable. It distinguishes from sibling git tools like git_show (shows specific commit details) or git_status (shows working tree status). However, it doesn't specify what 'details' includes (e.g., author, date, hash), which prevents a perfect score.

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 when to choose git_log over git_show (for specific commits) or git_status (for current state), nor does it indicate prerequisites like requiring an initialized repository. The agent must infer usage from the name and schema 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

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