Skip to main content
Glama

gitlab_list_branches

Retrieve a list of branches for a specified GitLab project by providing the project ID and optional search criteria.

Instructions

List branches of a GitLab project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe ID or URL-encoded path of the project
searchNoSearch branches by name

Implementation Reference

  • The main handler function that implements the gitlab_list_branches tool. It validates the project_id, calls the GitLab API to list branches, and formats the response.
    export const listBranches: ToolHandler = async (params, context) => {
      const { project_id, search } = params.arguments || {};
      if (!project_id) {
        throw new McpError(ErrorCode.InvalidParams, 'project_id is required');
      }
      
      const response = await context.axiosInstance.get(
        `/projects/${encodeURIComponent(String(project_id))}/repository/branches`,
        { params: { search } }
      );
      return formatResponse(response.data);
    };
  • The tool definition object specifying the name, description, and input schema (JSON Schema) for the gitlab_list_branches tool.
    {
      name: 'gitlab_list_branches',
      description: 'List branches of a GitLab project',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'The ID or URL-encoded path of the project'
          },
          search: {
            type: 'string',
            description: 'Search branches by name'
          }
        },
        required: ['project_id']
      }
  • The registration entry in the toolRegistry that maps the tool name 'gitlab_list_branches' to its handler function repoHandlers.listBranches.
    gitlab_list_branches: repoHandlers.listBranches,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists branches but omits critical behavioral details: whether it requires authentication, what permissions are needed, if results are paginated, the format of returned data, or any rate limits. For a read operation with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that immediately conveys the core functionality without any wasted words. It's front-loaded with the essential action and resource, making it easy for an agent to parse quickly. Every word earns its place by specifying what is being listed and for what type of entity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (listing resources with filtering), lack of annotations, and absence of an output schema, the description is incomplete. It doesn't address authentication needs, result format, pagination, error conditions, or how it differs from other listing tools. For a tool with no structured behavioral hints, the description should provide more context to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema fully documents both parameters (project_id and search). The description adds no additional parameter semantics beyond what's in the schema—it doesn't explain parameter interactions, provide examples, or clarify edge cases. This meets the baseline of 3 when the schema does the heavy lifting, but adds no extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and resource ('branches of a GitLab project'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'gitlab_list_projects' or 'gitlab_list_merge_requests', but the specificity of 'branches' provides inherent distinction. The description avoids tautology by not just restating the tool name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites (like needing project access), nor does it compare with similar listing tools (e.g., 'gitlab_list_projects' for projects instead of branches). The agent must infer usage solely from the tool name and description without explicit context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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

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