Skip to main content
Glama

Protect branch

gitlab_protect_branch

Protect a GitLab project branch to prevent unauthorized changes. Specify project_id and branch to apply branch protection through the GitLab API.

Instructions

Protect a specific branch in a project.

Args: **kwargs: Additional parameters for the request (e.g., project_id, branch).

Returns: Response: A wrapper containing the original response and a Branch model.

Raises: MissingParameterError: If the project_id or branch is missing. ParameterError: If invalid parameters are provided.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

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

Input Schema

NameRequiredDescriptionDefault
refNo
pageNo
branchNo
per_pageNo
max_pagesNo
project_idNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv27.3.20
    • removedInput schema / properties / api_parameters
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null
      -}
    • changedInput schema / properties / page / default
      Previous value: -1New value: +null
    • changedInput schema / properties / per_page / default
      Previous value: -100New value: +null
    • addedInput schema / properties / project_id / default
      Added value: +null
    • removedInput schema / required
      Removed value: -[
      -  "project_id"
      -]
  2. First observedv27.3.13

TDQS

C2.8/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, openWorldHint=true and idempotentHint=false, so safety profile is partly covered. The description does add real value by disclosing that missing project_id or branch raises MissingParameterError and invalid parameters raise ParameterError, effectively telling the agent that two schema-optional fields are actually required. It does not say what protection settings get applied, whether re-protecting an already-protected branch fails or is a no-op, or that the change is reversible via unprotect.

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

Conciseness3/5

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

The one-line summary is well front-loaded and the Raises section is useful. However, the 'Args: **kwargs' block is boilerplate noise that actively misleads, and the Returns line adds little beyond naming a Branch model.

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 6-parameter mutation with no output schema and zero schema coverage, the description is thin: it omits what protection entails, what the returned Branch model reflects, and how the pagination-like parameters interact with the call. The kwargs framing suggests the docstring was auto-generated rather than written for this tool.

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 6 parameters, so the description must carry the load. It names only project_id and branch, and does so under a misleading '**kwargs: Additional parameters for the request' heading, which contradicts a schema that declares named properties with additionalProperties=false. The pagination-shaped parameters (ref, page, per_page, max_pages) are never explained and their relevance to a protect operation is left completely opaque.

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 first line states a specific verb and resource ('Protect a specific branch in a project'), so the action is unambiguous. It does not distinguish itself from nearby siblings such as gitlab_unprotect_branch, gitlab_protect_tag, or gitlab_get_protected_branch, leaving the agent to infer the difference from the name alone.

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?

There is no guidance on when to use this versus gitlab_unprotect_branch or gitlab_update_protected_branch, and no prerequisites (permission level, existing branch state) are mentioned. The only routing hint is implicit in the tool name.

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