Merge Territories
territory_mergeMerges a pair of adjacent territories (N to N-1 territories). By default, territory_id_b is folded into territory_id_a (or renamed to new_territory_label) and the rest of the alignment rebalances with minimal disruption, e.g. when a rep leaves and neighbors absorb the territory. Set preserve_other_territories=true for an exact two-territory union that combines only territory_id_a and territory_id_b (optionally named new_territory_label) and leaves every other territory unchanged with no rebalance. Non-adjacent ids return NON_ADJACENT_TERRITORIES. Needs source_tal_id and the Territory Solution from map_session_id or ts_handle; workload rebalance needs dwell_time (CLARIFICATION_REQUIRED otherwise). Writes a new derived alignment. Returns a task.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "territory_merge"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| objective | No | ||
| ts_handle | No | Territory Solution reference (tsh_...) from a build, ingest_accounts, import_geojson, import_designer_project, or get_map_visualization; Territory Solutions are not accepted inline. | |
| dwell_time | No | ||
| part_layer | No | Part layer (e.g. us_zips). Required only when not inferable from the source TAL. | |
| point_layer | No | Optional point layer used to compute per-part workload/metric measures. When omitted, a uniform geography-only weighting is used. | |
| new_tal_label | No | Label for the derived TAL. Defaults to '<source label> (<operation>)'. | |
| repair_policy | No | Topology repair for dissolved territories. default fills interior holes in the dissolved geometry (no part is added or reassigned; repair_summary.changed_part_ids lists the territories' own parts). report_only detects holes and changes nothing (warning REPAIR_AVAILABLE). strict fails with REPAIR_REQUIRED when a hole is found. | default |
| source_tal_id | No | Source TAL. Optional for form-capable clients that can answer via elicitation. | |
| map_session_id | No | Open map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set. | |
| territory_id_a | No | First territory (id or label). The merged territory keeps this identity unless new_territory_label is supplied. | |
| territory_id_b | No | Second territory (id or label). Must be adjacent to territory_id_a. | |
| balance_tolerance | No | Accepted for compatibility. The power-diagram rebalance converges on its own internal tolerance, so this value no longer gates per-part moves. | |
| disruption_weight | No | Incumbency stickiness for the warm-started power-diagram rebalance. 0 is a pure power re-solve (max balance, more churn); higher values keep more of the source alignment by requiring a neighbor territory to inflate further before it can claim a border part. | |
| new_territory_label | No | Optional display label for the merged territory (defaults to territory_id_a's label). | |
| visit_frequency_field | No | Numeric visits-per-cycle column on the point layer. When omitted, inherits from source TAL build_provenance or point-layer metadata. | |
| preserve_other_territories | No | When true, performs an exact union of territory_id_a and territory_id_b without rebalancing any other territory in the alignment. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| error | No | Present when ok is false. | |
| result | No | Present when ok is true. A submission returns the task reference (task_id, next_action, sleep_ms); the completed task result carries the remaining fields. | |
| warnings | No |