Skip to main content
Glama

gitlab_delete_branch

Delete a branch from a GitLab project to manage repository structure and remove outdated code.

Instructions

Deletes a branch from a GitLab project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesThe path of the GitLab project.
branchNameYesThe name of the branch to delete.

Implementation Reference

  • Handler function for the 'gitlab_delete_branch' tool that extracts parameters and calls GitLabService.deleteBranch to perform the deletion.
    case 'gitlab_delete_branch': {
      if (!gitlabService) {
        throw new Error('GitLab service is not initialized.');
      }
      const { projectPath, branchName } = args as { projectPath: string; branchName: string };
      await gitlabService.deleteBranch(projectPath, branchName);
      return {
        content: [
          {
            type: 'text',
            text: `Branch ${branchName} deleted successfully.`,
          },
        ],
      };
    }
  • src/index.ts:791-808 (registration)
    Registers the 'gitlab_delete_branch' tool in the allTools array, including its name, description, and input schema.
    {
      name: 'gitlab_delete_branch',
      description: 'Deletes a branch from a GitLab project.',
      inputSchema: {
        type: 'object',
        properties: {
          projectPath: {
            type: 'string',
            description: 'The path of the GitLab project.',
          },
          branchName: {
            type: 'string',
            description: 'The name of the branch to delete.',
          },
        },
        required: ['projectPath', 'branchName'],
      },
    },
  • GitLabService method that performs the actual API call to delete the specified branch from the project.
    async deleteBranch(projectPath: string, branchName: string): Promise<void> {
      const encodedProjectPath = encodeURIComponent(projectPath);
      const encodedBranchName = encodeURIComponent(branchName);
      await this.callGitLabApi<any>(
        `projects/${encodedProjectPath}/repository/branches/${encodedBranchName}`,
        'DELETE',
      );
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Deletes') but doesn't describe critical traits: whether deletion is permanent or reversible, what permissions are required, if it affects associated merge requests or pipelines, or what the response looks like (success/failure indicators). For a destructive operation with zero annotation coverage, this is a significant gap in transparency.

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

Conciseness4/5

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

The description is a single, direct sentence that efficiently conveys the core action without unnecessary words. It's front-loaded with the key verb ('Deletes') and resource. However, it could be slightly more structured by including a brief note on implications or prerequisites, but as-is, it earns its place without waste.

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 destructive nature, lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like permanence, permissions, or error handling, nor does it explain return values. For a mutation tool with significant context gaps, the description should provide more guidance to ensure safe and correct usage.

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%, with both parameters ('projectPath' and 'branchName') clearly documented in the schema. The description doesn't add any meaning beyond what the schema provides—it doesn't explain parameter formats, constraints, or examples. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 ('Deletes') and resource ('a branch from a GitLab project'), making the purpose immediately understandable. It distinguishes from sibling tools like 'gitlab_create_branch' and 'gitlab_list_branches' by specifying deletion rather than creation or listing. However, it doesn't explicitly differentiate from other destructive operations like 'gitlab_close_issue' beyond the resource type.

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 prerequisites (e.g., needing appropriate permissions), when deletion is appropriate (e.g., after merging), or what happens to associated data. While siblings like 'gitlab_create_branch' and 'gitlab_get_branch_details' exist, no comparison or context is given to help choose between them.

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

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

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