Analyze Territories
analyzeComputes territory statistics for one or more alignments, i.e. how balanced the territories are and how alignments compare: account counts, declared metric totals (e.g. Revenue), workload hours, balance scores, and cross-TAL comparison; hypothetical_moves previews a realign. Input: map_session_id (the open map as it is now), ts_handle, or a completed build job_id (pass tal_ids when several TALs exist). metrics: omit for every declared column, or name them; workload and account_count are always available. Workload needs dwell (dwell_time, the build's recorded dwell, or the layer's dwell_time_field); without it the result has every other statistic, no workload, and workload_omitted.ask_user to put to the user. analysis_panel=single with map_session_id fills the map dock (analysis_panel.status=pushed). Territory account_count, metric_totals, workload_total (minutes), and the dock grid cover accounts_point_layer (build point_layer), never seed, contractor, or visit layers; point_counts_by_layer counts every layer. Drive-time alignments count accounts inside each polygon. 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": "analyze"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope | No | Optional — restrict analysis to a subset of parts or territories. | |
| job_id | No | task_id (same value as job_id) of a completed build or ingest task; its Territory Solution is the input. | |
| metrics | No | Data field names to aggregate per territory. If omitted, server returns all available metrics. | |
| tal_ids | No | TAL IDs to analyze. Defaults to the active TAL when unambiguous. | |
| max_depth | No | Optional. For hierarchical TALs, return rollup metrics only up to this depth level. Without it, every level is returned. | |
| 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 name. Required when not inferable from the TAL(s). Not used for a drive-time (isochrone) TAL, which is measured by polygon. | |
| compare_tals | No | When true and multiple tal_ids supplied, include a cross-TAL comparison section. | |
| analysis_panel | No | ||
| map_session_id | No | Open map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set. | |
| hypothetical_moves | No | Optional. Compute impact of these hypothetical part moves without persisting any change. | |
| visit_frequency_field | No | Optional visit-frequency point column override for workload recompute. |
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 |