# compare_branches

Compares two branches and shows the differences

Agent View of the PolicyLayer registry record for `compare_branches`. HTML page: https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/compare-branches

## Facts

- Tool: `compare_branches`
- Server: GitLab MCP Server (`ahmedbhl/mcp-server-gitlab`) — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab.md
- Homepage: https://github.com/ahmedbhl/mcp-server-gitlab
- Risk category: Read (Low risk)
- Registry record: grade B, identity unverified
- Server rate-limited: no
- Parameters: 0
- Recommended policy verdict: Allowed

## Example call (MCP tools/call, JSON-RPC 2.0)

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

## Why compare_branches is rated Low

This tool queries and retrieves branch comparison data without creating, modifying, deleting, or executing any operations. It is a read-only data retrieval function analogous to `get_commit_diff` (a sibling tool also in the Read category). The blast radius of misuse is minimal—an agent could only retrieve information about code differences, not alter repositories or trigger builds.

From the tool's own definition: "Tool description states 'shows the differences' between branches; no modification, deletion, or execution capability. The verb 'compare' and 'shows' indicate retrieval-only operations."

## Use case

AI agents call compare_branches to retrieve information from GitLab MCP Server without modifying anything. It is typically the context-gathering step in research, monitoring, and reporting workflows, before the agent takes action elsewhere.

## Recommended policy (PolicyLayer)

Verdict: **Allowed**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches GitLab MCP Server:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "compare_branches": {}
  }
}
```

## Other tools on GitLab MCP Server (18)

- `get_commit_details` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-commit-details.md
- `get_commit_diff` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-commit-diff.md
- `get_file_content` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-file-content.md
- `get_file_history` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-file-history.md
- `get_my_issues` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-my-issues.md
- `get_my_merge_requests` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-my-merge-requests.md
- `get_my_projects` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-my-projects.md
- `get_project_branches` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-project-branches.md
- `get_project_commits` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-project-commits.md
- `get_project_files` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-project-files.md
- `get_project_info` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-project-info.md
- `get_project_issues` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-project-issues.md
- `get_project_merge_requests` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-project-merge-requests.md
- `get_project_pipelines` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-project-pipelines.md
- `get_user_info` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/get-user-info.md
- `search_files_in_project` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/search-files-in-project.md
- `search_projects` — Read — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/search-projects.md
- `create_issue` — Write — https://policylayer.com/tools/ahmedbhl-mcp-server-gitlab/create-issue.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=ahmedbhl-mcp-server-gitlab · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/ahmedbhl-mcp-server-gitlab
