Skip to main content
Glama

Protect Branch

gitlab_protect_branch

Protect a GitLab branch or wildcard rule by configuring role-based push, merge, and unprotect access to control who can change protected refs.

Instructions

Protect a branch or wildcard rule and configure role-based push, merge, and unprotect access.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "branch": "<branch>"
    },
    "name": "gitlab_protect_branch"
  }
}

Input Schema

NameRequiredDescriptionDefault
branchYes
project_idNo
allow_force_pushNo
push_access_levelNo
merge_access_levelNo
unprotect_access_levelNo
code_owner_approval_requiredNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.7.0
    • removedInput schema / properties / allow_force_push / anyOf
      Removed value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedInput schema / properties / allow_force_push / type
      Added value: +[
      +  "boolean",
      +  "null"
      +]
    • removedInput schema / properties / code_owner_approval_required / anyOf
      Removed value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedInput schema / properties / code_owner_approval_required / type
      Added value: +[
      +  "boolean",
      +  "null"
      +]
  2. First observedv1.6.1

TDQS

B3.1/5.0
Behavior3/5

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

Annotations already disclose that this is a non-read-only, non-destructive, non-idempotent, open-world mutation, so the safety floor is covered. The description adds that access levels are role-based and that wildcard rules are supported, but never says what permissions are required, what happens to existing protections or other branches matched by a wildcard, or whether repeat calls overwrite prior settings.

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?

A single front-loaded sentence with no filler; the scope distinction (branch vs wildcard) comes first. It is efficient but too short to earn top marks given how much parameter context is missing.

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?

For a 7-parameter mutation tool with zero schema descriptions, no enum labels, and no output schema, the one-sentence description is insufficient. An agent would have to guess the meaning of the numeric access levels and the purpose of the boolean flags before it could call this correctly.

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

Parameters2/5

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

Schema description coverage is 0% across 7 parameters, so the description carries the burden and largely drops it. It names the push/merge/unprotect access concepts but never explains the access-level constants (0/30/40/60), and says nothing about branch naming, project_id, allow_force_push, or code_owner_approval_required.

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?

States a specific verb ('Protect') and resource ('a branch or wildcard rule') and adds the configuration scope (push, merge, unprotect access). This is enough for an agent to tell it apart from siblings like gitlab_protect_tag and gitlab_create_branch.

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

Usage Guidelines3/5

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

The phrase 'configure role-based push, merge, and unprotect access' implies this tool is also the route for adjusting an existing protection rule, but the description never states when to use it versus gitlab_update_protected_branch, gitlab_unprotect_branch, or gitlab_get_protected_branch. Usage is only implied.

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

Deploy Server

Other Tools