Skip to main content
Glama

list_commits

Retrieve a list of commits from a specific branch in a GitHub repository. Specify owner, repo, and optional parameters like SHA, page, and perPage to streamline commit history access.

Instructions

Get list of commits of a branch in a GitHub repository

Input Schema

NameRequiredDescriptionDefault
ownerYes
pageNo
perPageNo
repoYes
shaNo

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "owner": { "type": "string" }, "page": { "type": "number" }, "perPage": { "type": "number" }, "repo": { "type": "string" }, "sha": { "type": "string" } }, "required": [ "owner", "repo" ], "type": "object" }

Implementation Reference

  • The core handler function that performs the GitHub API request to list commits.
    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 }) ); }
  • Input schema (Zod) for validating tool arguments.
    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:118-122 (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) },
  • Dispatcher handler in CallToolRequest that parses arguments and invokes the core handler.
    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