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) }], }; }

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