Build Territories by Account Field
account_buildBuilds territories that follow an account column, such as rep name or territory code from CRM: each part goes to the group holding most of its accounts (conflict_policy). Adds a new alignment (TAL). Needs an ingested point_layer, grouping_field, part_layer, and tal_label. Grouping values are labels, not balance metrics. part_scope: bbox_intersect (default; parts near the accounts) or explicit with part_filter, e.g. {state_abbr: TX}; in_tal: {tal_id} keeps only that TAL's parts, not_in_tal: {tal_id} only the parts it leaves uncovered. A declared visit-frequency column needs visit_frequency_field or ignore_visit_frequency (CLARIFICATION_REQUIRED otherwise). With map_session_id the open map is the input. Returns a task; the result carries tal_id and ts_handle. analyze reports the statistics.
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": {
"point_layer": "<point_layer>"
},
"name": "account_build"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| part_ids | No | Explicit part selection set. Implies part_scope explicit. Mutually exclusive with part_filter. | |
| tal_label | 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. | |
| part_layer | No | ||
| part_scope | No | Parts eligible for Account Build geography. Default bbox_intersect: all parts intersecting the account-point bounding box. point_matched: only parts containing at least one account (radial seeds only; no FCFS inflate). explicit: part_ids or part_filter (e.g. state_abbr FL). Scope fill uses FCFS adjacency inflate from cluster radial seeds, not national nearest-anchor fill. | |
| output_mode | No | tal is the default. assignments returns assignments_artifact plus an authenticated download_url and a key-less share_url; no ts_handle, tal_id, or map_refresh. | tal |
| part_filter | No | Attribute filter resolved via query_parts (e.g. {"state_abbr": ["FL", "GA"]}). Implies part_scope explicit. Mutually exclusive with part_ids. An existing TAL's footprint (a new version over the same parts, all its regions): {"in_tal": {"tal_id": "tal-1"}}. White space (parts no TAL covers): add not_in_tal, e.g. {"state_abbr": "TX", "not_in_tal": {"tal_id": "tal-1"}}; a person-trimmed set is {"selection_task_id": "psel_..."} after get_part_selection reports committed. | |
| point_layer | Yes | ||
| 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 |
| grouping_field | No | Point feature property treated as a grouping label even when numeric. | |
| map_session_id | No | Open map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set. | |
| conflict_policy | No | When accounts in one part map to multiple grouping labels, assign the part to the label with the highest account count; ties break by deterministic label sort. | plurality_account_count |
| expected_revision | No | ||
| visit_frequency_field | No | Point column that scales territory workload by visits per cycle. Mutually exclusive with ignore_visit_frequency. | |
| ignore_visit_frequency | No | When true, every account is one visit per cycle. Mutually exclusive with visit_frequency_field. |
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 |