Skip to main content
Glama

Compare Branches

compare_branches
Read-only

Show what merging one branch into another branch of the same project would change. projectId is always the TARGET (the branch merged into); sourceProjectId is the branch merged in.

  • Output: changed files, every conflict with its marker text, the migration script, key conflicts, new env vars the target lacks, missing resources, and targetVersion / sourceVersion for start_merge.

  • With no conflicts it also starts the pre-merge checks in the background. Neither branch is changed.

  • Conflicts: a merge from x into y edits y; a merge into main edits the source branch (main is never edited by a merge). Fix each conflicted file there with edit_file / apply_patch so it holds both sides' changes.

  • When to use: the user asks to merge branches, what a merge would change, or to fix a failed merge. Flow: compare_branches → read_merge_conflict and fix each conflict → static/__dev/migration.js if the database or storage must change (get_guides("fork")) → compare_branches → start_merge → get_merge_status.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "projectId": "<projectId>",
      "sourceProjectId": "<sourceProjectId>"
    },
    "name": "compare_branches"
  }
}

Input Schema

NameRequiredDescriptionDefault
projectIdYes
sourceProjectIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false; the description reinforces this with 'Neither branch is changed' and adds a non-obvious side effect — pre-merge checks start in the background when there are no conflicts. It also enumerates the entire return payload (changed files, conflict marker text, migration script, env vars, missing resources, versions). Minor gap: it doesn't say what happens when the branch has diverged in ways it can't read or who can run it.

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 the core statement, then bulleted by output, side effects, conflict-editing rules, and when-to-use. Dense but every bullet earns its place. Slight redundancy between the opening target/source sentence and the later 'a merge from x into y edits y' restatement.

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

Completeness5/5

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

There is no output schema, so the description supplies the return shape itself, and it does so field by field. For a two-parameter read tool with a multi-step downstream flow, nothing an agent needs to call it correctly or interpret the result is missing.

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

Parameters5/5

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

Schema description coverage is 0%, so the description carries the full burden — and it does: projectId is the TARGET 'branch merged into' and sourceProjectId is the branch merged in. It even explains the counterintuitive edge case that a merge into main edits the source branch rather than main, which is semantics an agent could not derive from a bare string schema.

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?

Opens with a specific verb+resource ('Show what merging one branch into another branch of the same project would change') and immediately disambiguates direction: projectId is the TARGET, sourceProjectId is the branch merged in. That distinction is exactly what separates it from siblings like start_merge or read_merge_conflict.

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

Usage Guidelines5/5

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

Carries an explicit 'When to use' clause (user asks to merge, asks what a merge would change, or wants a failed merge fixed) plus a full ordered workflow: compare_branches → read_merge_conflict → migration.js → compare_branches → start_merge → get_merge_status. It also names the sibling tools (edit_file, apply_patch, get_guides) that handle the follow-up step.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources