list_commits
Retrieve recent commits from a GitHub repository by specifying the owner and repository name to track code changes and development history.
Instructions
List recent commits for a repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | ||
| repo | Yes |
Implementation Reference
- src/apis/github/github.ts:115-121 (handler)The handler function for the 'list_commits' tool. It validates the owner and repo arguments, checks for GitHub token configuration, and calls the GitHubClient's listCommits method.async list_commits(args: Record<string, unknown>) { if (!cfg.githubToken) throw new Error("GITHUB_TOKEN is not configured"); const owner = String(args.owner || ""); const repo = String(args.repo || ""); if (!owner || !repo) throw new Error("owner and repo are required"); return client.listCommits(owner, repo); },
- src/apis/github/github.ts:81-88 (schema)The input schema defining the required 'owner' and 'repo' string parameters for the list_commits tool.inputSchema: { type: "object", properties: { owner: { type: "string" }, repo: { type: "string" }, }, required: ["owner", "repo"], },
- src/apis/github/github.ts:78-89 (registration)The tool registration object that defines the name, description, and input schema for 'list_commits' within the registerGitHub function.{ name: "list_commits", description: "List recent commits for a repository", inputSchema: { type: "object", properties: { owner: { type: "string" }, repo: { type: "string" }, }, required: ["owner", "repo"], }, },
- src/apis/github/github.ts:29-31 (helper)The GitHubClient helper method that makes the API request to list commits for the given repository.listCommits(owner: string, repo: string) { return this.request(`/repos/${owner}/${repo}/commits`); }