Skip to main content
Glama

Branch

gitlab_branch
Destructive

Manage Git branches: create, delete, list, protect, unprotect. View aggregated branch rules via GraphQL including push/merge access, force push, code owner approval. Supports pagination.

Instructions

Example: {"action":"create","params":{...}} For the params schema of any action, read the MCP resource 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; consult this tool's description for the chosen action. Send only the fields documented for that action — unknown keys are rejected with a validation error (only reserved meta keys like `confirm` are stripped before validation). 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 complements the destructiveHint annotation by specifying which actions (delete/unprotect) are destructive and irreversible. It also details error responses with hints (e.g., permissions, validation), providing behavioral context beyond the annotation.

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 comprehensive and well-structured with sections (example, purpose, when/not, returns, errors, param conventions, per-action params, see also). While thorough, the per-action list is repetitive; a tabular format could be more concise, but overall it is organized and front-loaded.

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 (multiple actions, nested params, varied return types), the description covers all necessary context: action-level details, return schemas, error hints, and prerequisites. It is fully sufficient for an agent to use the tool correctly.

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 per-action parameter lists with meanings, required fields, access level codes, and parameter conventions (e.g., project_id*). This provides rich semantic context beyond the schema's structure.

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 it manages Git branches and branch protections, and enumerates all actions. It differentiates from siblings by explicitly listing what it is NOT for (file contents, commits, tags, MRs), making the tool's scope unambiguous.

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' and 'NOT for' sections, listing specific sibling tools for alternative operations. It also includes 'See also' references to related tools, giving clear guidance on when to use this tool versus others.

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