Skip to main content
Glama

list_commits

Retrieve commit history from a GitHub repository branch to track changes, review code evolution, and analyze development progress.

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 main handler function that executes the tool logic by making a GitHub API request to list commits in a repository.
    export async function listCommits( owner: string, repo: string, page?: number, perPage?: number, sha?: string ) { return githubRequest( buildUrl(`https://api.github.com/repos/${owner}/${repo}/commits`, { page: page?.toString(), per_page: perPage?.toString(), sha }) ); }
  • Zod input schema defining parameters for the list_commits tool: owner, repo, optional sha, page, perPage.
    export const ListCommitsSchema = z.object({ owner: z.string(), repo: z.string(), sha: z.string().optional(), page: z.number().optional(), perPage: z.number().optional() });
  • index.ts:119-122 (registration)
    Tool registration in the ListTools response, specifying name, description, and input schema.
    name: "list_commits", description: "Get list of commits of a branch in a GitHub repository", inputSchema: zodToJsonSchema(commits.ListCommitsSchema) },
  • index.ts:335-347 (registration)
    Dispatch logic in the CallToolRequest handler that parses arguments and invokes the listCommits function.
    case "list_commits": { const args = commits.ListCommitsSchema.parse(request.params.arguments); const results = await commits.listCommits( 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/PhialsBasement/mcp-github-server-plus'

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