Skip to main content
Glama

Branch

gitlab_branch
Destructive

Create, list, delete, protect, unprotect Git branches and audit aggregated branch protection rules via GraphQL.

Instructions

Use {"action":"create","params":{...}}; only top-level keys are action and params. Action params schema: gitlab://schema/meta/gitlab_branch/.

Manage Git branches and branch protections in a project, plus aggregated branch rules (GraphQL). Delete and unprotect are destructive and irreversible. When to use: create/list/delete branches, protect or update protection on branches, audit aggregated branch rules (push/merge access, approval rules, status checks). NOT for: file contents on a branch (use gitlab_repository file_get/file_create/...), commit operations (use gitlab_repository commit_*), tags (use gitlab_tag), opening MRs against a branch (use gitlab_merge_request).

Returns:

  • list / list_protected: array of {name, default, protected, merged, commit, ...} with pagination.

  • get / get_protected / create / protect / update_protected: branch or protection object.

  • delete / delete_merged / unprotect: {success: bool, message: string}.

  • rule_list: GraphQL aggregated view {nodes: [{name, branch_protection, approval_rules, external_status_checks}], page_info}. Errors: 404 not found, 403 forbidden (hint: requires Maintainer+ to protect/unprotect), 400 invalid params (hint: cannot delete default or protected branches — unprotect first).

Param conventions: * = required. All actions need project_id* (numeric or url-encoded path) except rule_list which uses project_path*. Access levels: 0 = no one, 30 = Developer, 40 = Maintainer.

  • create: project_id*, branch_name*, ref* (branch/tag/SHA)

  • get / delete: project_id*, branch_name*

  • list: project_id*, search, page, per_page

  • delete_merged: project_id* — deletes all merged branches except default/protected

  • protect: project_id*, branch_name*, push_access_level (0/30/40), merge_access_level (0/30/40), allow_force_push (bool)

  • unprotect: project_id*, branch_name*

  • list_protected: project_id*

  • get_protected: project_id*, branch_name*

  • update_protected: project_id*, branch_name*, allow_force_push (bool), code_owner_approval_required (bool)

  • rule_list: project_path* (e.g. my-group/my-project), first (max 100), after (cursor)

See also: gitlab_repository (file/commit operations on a branch), gitlab_merge_request (open MRs against a branch), gitlab_tag (tag CRUD/protection).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform. Pick exactly one of the values in `enum`. Each action expects its own `params` object — see the tool description for the per-action parameter list.
paramsNoAction-specific parameters as a JSON object. Required and optional fields differ per action. This envelope schema stays broad; runtime validation applies the chosen action's schema after reserved meta keys like `confirm` are stripped. For the JSON Schema of a specific action's `params`, read the MCP resource `gitlab://schema/meta/{tool}/{action}` (replace placeholders with the tool name and the chosen action).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
next_stepsNoOptional. Suggested follow-up actions or tool calls for the LLM, contextual to the result.
paginationNoPresent on list actions. Use `has_more` and `next_page` to paginate through results.
Behavior5/5

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

The description discloses destructive actions: 'Delete and unprotect are destructive and irreversible.' It explains error responses and permissions: '404 not found, 403 forbidden (hint: requires Maintainer+).' Annotations include destructiveHint=true, and the description adds context beyond that, such as the irreversibility and specific error hints.

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 well-structured with clear sections: usage, not for, returns, errors, parameter conventions, per-action details, and see also. It is front-loaded with the action format. Despite length, every sentence provides necessary information without redundancy.

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

Completeness5/5

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

Given the tool's complexity (11 actions, varying params, GraphQL rules), the description is remarkably complete. It covers return types for each action, error conditions, permission hints, and cross-references to schema resources. The output schema is noted, but the description already provides adequate behavioral insight.

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

Parameters5/5

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

Schema coverage is 100%, and the description adds significant meaning: it lists each action with required and optional parameters, explains access levels (0=no one, 30=Developer, etc.), and notes differences like 'rule_list uses project_path*'. This goes well beyond the schema's property descriptions.

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

Purpose5/5

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

The description clearly states the tool's purpose: 'Manage Git branches and branch protections in a project, plus aggregated branch rules.' It lists specific actions (create/list/delete branches, protect/unprotect, audit rules) and explicitly distinguishes from sibling tools (e.g., 'NOT for: file contents on a branch (use gitlab_repository)...').

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

Usage Guidelines5/5

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

The description provides explicit when-to-use guidance: branches, protections, rules. It also gives clear when-not-to-use guidance with alternative tools: 'NOT for: file contents... (use gitlab_repository), commit operations..., tags (use gitlab_tag), opening MRs...' This helps the agent select the correct tool.

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

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