Skip to main content
Glama

protect_branch

Apply protection rules to a GitLab branch by specifying access levels for push, merge, and unprotect actions. Uses dry-run mode to preview changes before execution.

Instructions

Protect a branch with given push/merge/unprotect access levels. Access levels: 0=NoAccess, 30=Developer, 40=Maintainer, 60=Admin. dry_run=true by default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID
nameYesBranch name or wildcard pattern (e.g. 'main', 'release/*')
push_access_levelNoMinimum role required to push (default: 40=Maintainer)
merge_access_levelNoMinimum role required to merge (default: 40=Maintainer)
unprotect_access_levelNoMinimum role required to unprotect (default: 40=Maintainer)
dry_runNoDry run mode (default: true). When true, returns a preview of the action without executing it. Set to false only after user confirmation.
Behavior3/5

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

Annotations provide readOnlyHint=false, indicating a write operation. The description adds the dry_run behavior, which is useful. However, it does not disclose other behaviors such as overwriting existing protection, required permissions, or side effects. The dry_run parameter's confirmation note in schema is good, but description could be richer.

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 consists of two concise sentences, each adding essential information: purpose and key details (access levels, dry_run). No wasted words, front-loaded with the core action.

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?

With no output schema, the description should cover return value or success indicator. It does not explain what the tool returns upon successful protection (e.g., the protected branch object). Also missing error conditions, auth requirements, and when to use dry_run=false. The description is incomplete for an agent to safely invoke the tool.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents parameters well. The description adds a mapping table for access levels (0,30,40,60), which is partially redundant with schema default comments but clarifies the numeric codes. The dry_run default and behavior are also reiterated, adding marginal value.

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 'Protect a branch with given push/merge/unprotect access levels', using a specific verb and resource. It distinguishes from siblings like 'unprotect_branch' and 'list_protected_branches' by specifying the three access levels and the dry_run feature.

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 description implies dry_run usage ('dry_run=true by default') but does not explicitly state when to use this tool versus alternatives like 'unprotect_branch' or 'list_protected_branches'. No prerequisites or conditions are mentioned.

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

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