Skip to main content
Glama

list_commits

Retrieve commit history from GitHub repositories to track changes, review code evolution, and analyze development activity for any branch.

Instructions

Get list of commits of a branch in a GitHub repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYes
repoYes
shaNo
pageNo
perPageNo

Implementation Reference

  • The core handler function for the 'list_commits' tool. It constructs the GitHub API URL for listing commits and makes the authenticated request using githubRequest and buildUrl helpers.
    export async function listCommits(
      github_pat: string,
      owner: string,
      repo: string,
      page?: number,
      perPage?: number,
      sha?: string
    ) {
      return githubRequest(
        github_pat,
        buildUrl(`https://api.github.com/repos/${owner}/${repo}/commits`, {
          page: page?.toString(),
          per_page: perPage?.toString(),
          sha
        })
      );
    }
  • Input schema for list_commits tool (without github_pat, which is added separately).
    export const ListCommitsSchema = z.object({
      owner: z.string(),
      repo: z.string(),
      sha: z.string().optional(),
      page: z.number().optional(),
      perPage: z.number().optional()
    });
  • Extended input schema including the required github_pat for internal parsing.
    export const _ListCommitsSchema = ListCommitsSchema.extend({
      github_pat: z.string()
    });
  • src/index.ts:123-127 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema.
    {
      name: "list_commits",
      description: "Get list of commits of a branch in a GitHub repository",
      inputSchema: zodToJsonSchema(commits.ListCommitsSchema)
    },
  • src/index.ts:509-522 (registration)
    Dispatch handler in CallToolRequest that parses arguments and invokes the listCommits function.
    case "list_commits": {
      const args = commits._ListCommitsSchema.parse(params.arguments);
      const results = await commits.listCommits(
        args.github_pat,
        args.owner,
        args.repo,
        args.page,
        args.perPage,
        args.sha
      );
      return {
        content: [{ type: "text", text: JSON.stringify(results, null, 2) }],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves commit lists but lacks critical details: whether it's read-only (implied but not explicit), requires authentication, has rate limits, returns paginated results (suggested by 'page' and 'perPage' parameters but not described), or what the output format is. This leaves significant gaps in understanding 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 of the sentence contributes directly to understanding the tool's function, making it highly concise and well-structured.

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 complexity (5 parameters, no annotations, no output schema), the description is incomplete. It doesn't cover parameter meanings, behavioral traits like authentication or pagination, or output details. For a tool with multiple parameters and no structured support, this leaves the agent under-informed about how to use it effectively.

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 schema provides no parameter documentation. The description mentions 'branch' and 'GitHub repository', which loosely map to 'sha' and 'owner/repo', but it doesn't explain any parameters explicitly—such as what 'sha' represents (branch name, commit hash), or how 'page' and 'perPage' affect pagination. This fails to compensate for the lack of schema descriptions.

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 of commits') and resource ('of a branch in a GitHub repository'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_commit_statuses' or 'search_code' that might also involve commits, leaving room for ambiguity in tool selection.

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 (e.g., authentication needs), exclusions, or compare it to similar tools like 'list_issues' or 'search_code' for commit-related queries, leaving the agent to infer usage context.

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/MissionSquad/mcp-github'

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