Skip to main content
Glama

Reintegrate Alignment Branch

reintegrate_branch
Destructive

Merges an edited branch (proposal Territory Solution from extract_tal_branch) back into the master. Needs branch_metadata and expected_master_revision; returns STALE_TS_REVISION when the master changed since the extract, in which case a fresh extract is needed. Merges apply one at a time.

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": {
      "expected_master_revision": "<expected_master_revision>",
      "branch_metadata": "<branch_metadata>"
    },
    "name": "reintegrate_branch"
  }
}

Input Schema

NameRequiredDescriptionDefault
map_session_idNoOpen map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set.
branch_metadataYes
master_ts_handleNoTerritory Solution reference (tsh_...) from a build, ingest_accounts, import_geojson, import_designer_project, or get_map_visualization; Territory Solutions are not accepted inline.
proposal_ts_handleNoTerritory Solution reference (tsh_...) from a build, ingest_accounts, import_geojson, import_designer_project, or get_map_visualization; Territory Solutions are not accepted inline.
expected_master_revisionYes
expected_master_content_hashNo

Output Schema

NameRequiredDescriptionDefault
okYes
errorNoPresent when ok is false.
resultNoPresent when ok is true.
warningsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed15 schema fields changed
    • changedInput schema / properties / branch_metadata / additionalProperties
      Previous value: -trueNew value: +false
    • addedInput schema / properties / branch_metadata / anyOf
      Added value: +[
      +  {
      +    "required": [
      +      "branch_part_ids"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "branch_part_ids_sha256",
      +      "branch_part_ids_count"
      +    ]
      +  }
      +]
    • addedInput schema / properties / branch_metadata / oneOf
      Added value: +[
      +  {
      +    "required": [
      +      "branch_rollup_territory_id"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "branch_territory_path"
      +    ]
      +  }
      +]
    • addedInput schema / properties / branch_metadata / properties
      Added value: +{
      +  "branch_part_ids": {
      +    "items": {
      +      "type": "string"
      +    },
      +    "minItems": 1,
      +    "type": "array"
      +  },
      +  "branch_part_ids_count": {
      +    "minimum": 1,
      +    "type": "integer"
      +  },
      +  "branch_part_ids_sha256": {
      +    "pattern": "^sha256:[A-Fa-f0-9]{64}$",
      +    "type": "string"
      +  },
      +  "branch_rollup_territory_id": {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "branch_territory_path": {
      +    "items": {
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "maxItems": 5,
      +    "minItems": 1,
      +    "type": "array"
      +  },
      +  "delegate_ref": {
      +    "type": "string"
      +  },
      +  "extract_revision": {
      +    "minimum": 0,
      +    "type": "integer"
      +  },
      +  "extract_ts_id": {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "extracted_at": {
      +    "format": "date-time",
      +    "type": "string"
      +  },
      +  "locked_part_ids": {
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  },
      +  "master_content_hash": {
      +    "pattern": "^sha256:[A-Fa-f0-9]{64}$",
      +    "type": "string"
      +  },
      +  "master_revision": {
      +    "minimum": 0,
      +    "type": "integer"
      +  },
      +  "master_ts_id": {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "parent_ts_id": {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "point_layer_scope": {
      +    "const": "branch_parts_only",
      +    "type": "string"
      +  },
      +  "tal_id": {
      +    "minLength": 1,
      +    "type": "string"
      +  }
      +}
    • addedInput schema / properties / branch_metadata / required
      Added value: +[
      +  "master_ts_id",
      +  "master_revision",
      +  "tal_id",
      +  "extract_ts_id",
      +  "extract_revision",
      +  "parent_ts_id",
      +  "extracted_at",
      +  "point_layer_scope"
      +]
    • changedInput schema / properties / branch_metadata / title
      Previous value: -"Branch Metadata"New value: +"Branch Extract Metadata"
    • addedInput schema / properties / map_session_id / description
      Added value: +"Open map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set."
    • removedInput schema / properties / master_ts
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Master Ts"
      -}
    • addedInput schema / properties / master_ts_handle / description
      Added value: +"Territory Solution reference (tsh_...) from a build, ingest_accounts, import_geojson, import_designer_project, or get_map_visualization; Territory Solutions are not accepted inline."
    • removedInput schema / properties / proposal_ts
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Proposal Ts"
      -}
    • addedInput schema / properties / proposal_ts_handle / description
      Added value: +"Territory Solution reference (tsh_...) from a build, ingest_accounts, import_geojson, import_designer_project, or get_map_visualization; Territory Solutions are not accepted inline."
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / properties
      Added value: +{
      +  "error": {
      +    "description": "Present when ok is false.",
      +    "properties": {
      +      "ask_user": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "code": {
      +        "type": "string"
      +      },
      +      "details": {
      +        "type": "object"
      +      },
      +      "do_this_next": {
      +        "type": "object"
      +      },
      +      "message": {
      +        "type": "string"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  "ok": {
      +    "type": "boolean"
      +  },
      +  "result": {
      +    "description": "Present when ok is true.",
      +    "properties": {
      +      "reintegrate_result": {
      +        "type": "object"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  "warnings": {
      +    "items": {
      +      "properties": {
      +        "code": {
      +          "type": "string"
      +        },
      +        "message": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "type": "array"
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "ok"
      +]
    • removedOutput schema / title
      Removed value: -"reintegrate_branchDictOutput"
  2. Changed1 schema field changed
    • removedInput schema / properties / guidance_handle
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Guidance Handle"
      -}
  3. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already mark the tool destructive, non-idempotent, and not read-only, so the description is not responsible for basic safety disclosure. It adds valuable behavioral context beyond annotations: STALE_TS_REVISION signals optimistic-locking failure when the master changed, and merges apply one at a time, which informs retry and concurrency handling.

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 definition is three tight sentences with no filler, and the core action is front-loaded. Each sentence contributes either the action, the required inputs/error behavior, or the merge concurrency constraint.

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?

Given the output schema and annotations, the description covers the essential call context: what is merged, required inputs, stale-revision failure, and serial merge behavior. The main gap is that the deeply nested branch_metadata contract is not summarized in the description, though the schema carries its structure.

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?

The description names the two required inputs, branch_metadata and expected_master_revision, but does not explain the structure or meaning of branch_metadata's many nested fields. With only 50% schema description coverage, the description adds some context by tying the branch to extract_tal_branch, but it largely leaves parameter semantics to the 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?

The description states a specific verb and resource: it merges an edited branch proposal back into the master, and it names extract_tal_branch as the source of the branch. This clearly distinguishes it from the reverse extract operation and from unrelated siblings like territory_merge.

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?

It explains that the branch comes from extract_tal_branch and that branch_metadata plus expected_master_revision are needed, which gives clear context for when to call it. It also describes the stale-revision case where a fresh extract is required, though it does not spell out explicit alternatives for every merge-related scenario.

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