Skip to main content
Glama

Protect branch

gitlab_protect_branch

Protects a specific branch in a GitLab project by applying branch protection settings using the project ID and branch name.

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.

Input Schema

NameRequiredDescriptionDefault
refNo
pageNo
branchNo
per_pageNo
max_pagesNo
project_idYes
api_parametersNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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 declare this is a write, non-idempotent, non-destructive open-world call. The description adds useful facts the annotations do not cover: the return is a wrapper containing a Branch model, and MissingParameterError/ParameterError can be raised. It omits what protection actually means (push/merge access levels) and what happens when a branch is already protected, which matters given idempotentHint=false.

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 leading sentence is well front-loaded, but the Args/Returns/Raises docstring scaffolding wastes a bullet on '**kwargs: Additional parameters' instead of naming real arguments. Structure is mechanical rather than purposeful.

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 with no output schema and no annotation-level detail about semantics, the description should explain access-level configuration, branch requirement, and the odd pagination parameters. The return format is covered, but the core behavior of what 'protect' changes in GitLab is missing.

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% for 7 parameters, so the description must compensate and does not. It only alludes to project_id and branch via a kwargs example and an error clause, and even that is inconsistent with the schema, which marks branch nullable and only project_id required. Pagination-style parameters (page, per_page, max_pages) and ref/api_parameters are entirely unexplained on a protect operation.

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 sentence gives a specific verb and resource: 'Protect a specific branch in a project.' An agent can tell it creates protection rather than removing it. However, it never contrasts itself with close siblings such as gitlab_unprotect_branch, gitlab_protect_tag, or gitlab_update_protected_branch, so differentiation is left to the name.

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 statement of when to use this versus gitlab_unprotect_branch, gitlab_protect_tag, or gitlab_require_code_owner_approvals_single_branch. Prerequisites (maintainer/owner permission, pre-existing branch) are not mentioned either. The only implicit signal is that a branch must exist in a project.

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