Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

list-commits

Retrieve commit history for a specific branch in a GitHub repository to track code changes and review development progress.

Instructions

Get list of commits of a branch in a GitHub repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYes
pageNo
perPageNo
repoYes
shaNo

Implementation Reference

  • src/server.ts:249-274 (registration)
    Tool registration in the ListToolsRequestHandler, including name, description, and input schema definition.
    {
      name: 'list-commits',
      description: 'Get list of commits of a branch in a GitHub repository',
      inputSchema: {
        type: 'object',
        properties: {
          owner: {
            type: 'string',
          },
          repo: {
            type: 'string',
          },
          sha: {
            type: 'string',
          },
          page: {
            type: 'number',
          },
          perPage: {
            type: 'number',
          },
        },
        required: ['owner', 'repo'],
        additionalProperties: false,
      },
    },
  • The core handler function implementing the list-commits tool. Parses input with ListCommitsSchema, calls GitHub API repos.listCommits, formats and returns commit data.
    export async function listCommits(args: unknown): Promise<any> {
      const { owner, repo, sha, page, perPage } = ListCommitsSchema.parse(args);
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().repos.listCommits({
          owner,
          repo,
          sha,
          page,
          per_page: perPage,
        });
    
        return data.map((commit) => ({
          sha: commit.sha,
          commit: {
            author: commit.commit.author,
            committer: commit.commit.committer,
            message: commit.commit.message,
          },
          author: commit.author ? {
            login: commit.author.login,
            id: commit.author.id,
            type: commit.author.type,
          } : null,
          committer: commit.committer ? {
            login: commit.committer.login,
            id: commit.committer.id,
            type: commit.committer.type,
          } : null,
          html_url: commit.html_url,
        }));
      }, 'Failed to list commits');
    }
  • Zod schema for input validation used in the listCommits handler. Extends OwnerRepoSchema with optional sha, page, perPage.
    export const ListCommitsSchema = OwnerRepoSchema.extend({
      sha: z.string().optional(),
      page: z.number().optional(),
      perPage: z.number().optional(),
    });
  • Dispatch case in CallToolRequestHandler switch statement that invokes the listCommits handler.
    case 'list-commits':
      result = await listCommits(parsedArgs);
      break;
  • Import of getGitHubApi helper used to obtain the GitHub Octokit instance.
    import { getGitHubApi } from '../utils/github-api.js';
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions 'Get list' which implies a read-only operation, but doesn't disclose pagination behavior (despite 'page' and 'perPage' parameters), rate limits, authentication requirements, or what the output looks like. This leaves significant gaps for an agent to understand how the tool behaves.

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 without unnecessary words. Every part ('Get list', 'commits', 'branch', 'GitHub repository') contributes directly to understanding the tool's function.

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?

For a tool with 5 parameters, 0% schema coverage, no annotations, and no output schema, the description is inadequate. It doesn't explain parameter meanings, behavioral traits like pagination or authentication, or what the return value contains. The agent would struggle to use this tool correctly without external knowledge.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate but adds no parameter information. It mentions 'branch' which loosely relates to the 'sha' parameter (often used for branch names), but doesn't explain what 'owner', 'repo', 'page', or 'perPage' mean or how they interact. This leaves 5 parameters largely undocumented.

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 clearly states the action ('Get list') and resource ('commits of a branch in a GitHub repository'), making the purpose immediately understandable. It doesn't explicitly differentiate from siblings like 'list-issues' or 'list-pull-requests', but the specificity of 'commits' provides natural distinction.

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 prerequisites like authentication needs, rate limits, or how it compares to similar listing tools (e.g., for pagination or filtering). The agent must infer usage from the name and parameters 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/piyushgIITian/github-enterprice-mcp'

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