Skip to main content
Glama

get_branch

Read-only

Retrieve a GitLab branch's commit and protection status by providing the project ID and branch name.

Instructions

Get branch details (commit, protection status). To find resources, use the matching list or search tool. Read-only; missing resources, denied access, and rate limits return errors. project_id/group_id take a numeric ID or URL-encoded path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jmespathNoOptional JMESPath expression filtering the JSON result before return.
project_idYesProject ID or complete URL-encoded path to project
branch_nameYesName of the branch

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.1.66
    • addedInput schema / properties / jmespath
      Added value: +{
      +  "description": "Optional JMESPath expression filtering the JSON result before return.",
      +  "type": "string"
      +}
  2. Changed1 schema field changedv2.1.62
    • changedInput schema / required
      Previous value: -[
      -  "branch_name",
      -  "project_id"
      -]New value: +[
      +  "project_id",
      +  "branch_name"
      +]
  3. Addedv2.1.18
  4. Removedv2.1.14
  5. Addedv2.1.12

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, so safety is covered, but the description adds genuinely useful behavior: read-only, and that missing resources, denied access, and rate limits surface as errors. It also clarifies accepted identifier formats. It does not describe pagination or payload shape, but that is minor here.

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?

Front-loaded with purpose, then routing, then behavioral notes; tight and free of filler. The identifier-format note at the end is slightly out of place but still earns its space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a three-parameter read with no output schema, the description names the returned fields, error conditions, and identifier formats, which is close to complete. The stray group_id mention is the only loose end.

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 coverage is 100%, so all three parameters are already documented; the description only reinforces the project_id format ('numeric ID or URL-encoded path'). It also references `group_id`, which is not a parameter of this tool, adding slight confusion rather than new meaning.

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?

States a specific verb and resource ('Get branch details') and even enumerates the payload ('commit, protection status'), which an agent can distinguish from list_branches. The contrast with the list/search family is implied by the routing sentence.

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

Usage Guidelines4/5

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

Explicitly routes the agent to the matching list or search tool to find resources, implying get_branch is for when the branch name is already known. It gives clear context but no explicit statement of when this tool is the wrong choice beyond that.

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