Skip to main content
Glama
Alosies
by Alosies

get_project_commits

List commits in a GitLab project by project ID, with options to filter by branch, date range, author, and pagination settings.

Instructions

List commits in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
authorNoFilter by author name
per_pageNoNumber of results per page (max 100)
project_idYesProject ID or path
ref_nameNoBranch, tag, or commit SHAmain
sinceNoISO 8601 date format (YYYY-MM-DDTHH:MM:SSZ)
untilNoISO 8601 date format (YYYY-MM-DDTHH:MM:SSZ)

Implementation Reference

  • The main handler function that implements the get_project_commits tool logic by constructing GitLab API query parameters and fetching commits.
    async getProjectCommits(args: GetProjectCommitsParams) { const params = new URLSearchParams(); if (args.ref_name) params.append("ref_name", args.ref_name); if (args.since) params.append("since", args.since); if (args.until) params.append("until", args.until); if (args.author) params.append("author", args.author); if (args.path) params.append("path", args.path); if (args.all !== undefined) params.append("all", String(args.all)); if (args.with_stats !== undefined) params.append("with_stats", String(args.with_stats)); if (args.first_parent !== undefined) params.append("first_parent", String(args.first_parent)); if (args.order) params.append("order", args.order); if (args.trailers !== undefined) params.append("trailers", String(args.trailers)); if (args.page) params.append("page", String(args.page)); params.append("per_page", String(args.per_page || 20)); const data = await this.client.get( `/projects/${encodeURIComponent( args.project_id )}/repository/commits?${params.toString()}` ); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
  • Tool registration definition including name, description, and input schema for get_project_commits.
    { name: "get_project_commits", description: "List repository commits with filtering options", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "Project ID or path", }, ref_name: { type: "string", description: "Branch, tag, or commit SHA", default: "main", }, since: { type: "string", description: "ISO 8601 date format (YYYY-MM-DDTHH:MM:SSZ) - commits after this date", }, until: { type: "string", description: "ISO 8601 date format (YYYY-MM-DDTHH:MM:SSZ) - commits before this date", }, author: { type: "string", description: "Filter commits by author name", }, path: { type: "string", description: "Filter commits by file path", }, all: { type: "boolean", description: "Retrieve every commit from the repository", }, with_stats: { type: "boolean", description: "Include commit stats (additions, deletions)", }, first_parent: { type: "boolean", description: "Follow only the first parent commit on merge commits", }, order: { type: "string", enum: ["default", "topo"], description: "List commits in order (default or topological)", }, trailers: { type: "boolean", description: "Parse and include Git trailers for every commit", }, page: { type: "number", description: "Page number for pagination (default: 1)", }, per_page: { type: "number", description: "Number of results per page (max 100)", maximum: 100, default: 20, }, }, required: ["project_id"], }, },
  • TypeScript interface defining the parameters for the getProjectCommits handler.
    export interface GetProjectCommitsParams { project_id: string; ref_name?: string; since?: string; until?: string; author?: string; path?: string; all?: boolean; with_stats?: boolean; first_parent?: boolean; order?: 'default' | 'topo'; trailers?: boolean; page?: number; per_page?: number; }
  • src/server.ts:273-276 (registration)
    Dispatch/registration in the main server handler switch statement that routes calls to the repository handler.
    case "get_project_commits": return await this.repositoryHandlers.getProjectCommits( args as unknown as GetProjectCommitsParams );

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/Alosies/gitlab-mcp-server'

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