Skip to main content
Glama
Alosies
by Alosies

list_project_branches

Retrieve and search through branches within a GitLab project to view available development lines and manage code versions effectively.

Instructions

List branches in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
per_pageNoNumber of results per page (max 100)
project_idYesProject ID or path
searchNoSearch branches by name

Implementation Reference

  • The main handler function that executes the logic for the 'list_project_branches' tool by querying the GitLab API for project branches and returning the JSON response.
    async listProjectBranches(args: ListProjectBranchesParams) { const params = new URLSearchParams(); if (args.search) params.append("search", args.search); params.append("per_page", String(args.per_page || 20)); const data = await this.client.get( `/projects/${encodeURIComponent( args.project_id )}/repository/branches?${params.toString()}` ); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
  • Registration of the 'list_project_branches' tool, defining its name, description, and input schema for the MCP server.
    { name: "list_project_branches", description: "List branches in a project", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "Project ID or path", }, search: { type: "string", description: "Search branches by name", }, per_page: { type: "number", description: "Number of results per page (max 100)", maximum: 100, default: 20, }, }, required: ["project_id"], }, },
  • TypeScript interface defining the input parameters for the list_project_branches tool, imported and used by the handler.
    export interface ListProjectBranchesParams { project_id: string; search?: string; per_page?: number; }
  • src/server.ts:269-272 (registration)
    Dispatch/registration in the MCP server switch statement that routes calls to the 'list_project_branches' handler.
    case "list_project_branches": return await this.repositoryHandlers.listProjectBranches( args as unknown as ListProjectBranchesParams );

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