Skip to main content
Glama

approve_merge

Approve and merge a reviewed story's PR: rebase, re-run CI and tests, then merge and update the manifest.

Instructions

Merge a reviewed story's PR into the default branch, right now, on the caller's explicit approval — this is the human/overlord merge decision itself, not a status check.

plan_name: the plan's name, as returned by list_plans or passed to save_plan/ingest_plan. story_key: the story's key within that plan's manifest. Must currently be "parked" or "pr_open" with review_verdict == "APPROVE" — any other state (not yet reviewed, still in progress, already merged) returns {"ok": False, "error": ...} without changing anything.

On success this: rebases the story's branch onto the current default branch, force-pushes it (--force-with-lease) to origin, polls real CI (gh pr checks) — auto-retrying once on a cancelled run, and failing closed on a fail/cancelled/still-pending result — re-runs the story's acceptance fixtures and a build check against the rebased code, then merges the PR, deletes the branch/worktree, marks the story "done" in the manifest and its ticket, and notifies the user to restart the MCP server if the story touched the pipeline's own source. Any failure at any of those steps aborts the merge and returns the specific reason instead of partially completing it.

This does more than a plain gh pr merge (which skips the rebase, force-push, and re-verification) — prefer this tool over a manual merge for exactly that reason. It force-pushes and merges regardless of any local test run you've done yourself, so only call it once you actually want this specific story merged now; there is no separate confirmation step after this call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
plan_nameYes
story_keyYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure, and it does so thoroughly: it enumerates the entire merge pipeline (rebase, force-push with --force-with-lease, CI polling with retry, acceptance re-run, merge, branch/worktree cleanup, manifest/ticket update, server restart notice), emphasizes atomic abort-on-failure, and warns that force-push and merge happen regardless of local test runs.

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 is long but every sentence earns its place: the core purpose is front-loaded, parameter semantics follow, then the detailed behavioral pipeline, then usage cautions. There is no filler or repetition; the length is justified by the destructive and irreversible nature of the operation.

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?

Given the tool's complexity, the absence of annotations, and the presence of an output schema, the description is complete: it covers preconditions, side effects, failure semantics, alternatives, and success/error behavior. Nothing an agent needs to safely decide to call this tool 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?

The schema has 0% description coverage, so the description must compensate, and it does: plan_name is defined as returned by list_plans or passed to save_plan/ingest_plan, and story_key is defined as the story's key within that plan's manifest with the exact state constraints ('parked' or 'pr_open' with 'APPROVE'). Both parameters receive clear, operational meaning beyond their bare schema types.

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 opens with a specific verb and resource: 'Merge a reviewed story's PR into the default branch, right now, on the caller's explicit approval.' It also clarifies what the tool is not ('not a status check') and distinguishes itself from a plain `gh pr merge`, so an agent can tell exactly what action it performs.

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?

It explicitly states when to use the tool ('only call it once you actually want this specific story merged now'), states the required precondition state ('parked' or 'pr_open' with review_verdict == 'APPROVE'), and names the alternative ('plain `gh pr merge`') while explaining why this tool is preferred. It also warns there is no separate confirmation step.

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