Skip to main content
Glama

Auto-Build Territories

auto_build

Partitions ingested accounts into balanced sales territories with equal workload, metric, or count over a part layer (e.g. ZIPs) as a new alignment (TAL). User choices: build_mode (fixed_territory_count + territory_count, fixed_workload_target + target_workload hours, or scoped_split), objective (workload_bias = drive + dwell, metric_bias = one column, e.g. Revenue, count_bias = account count; sum 100), and dwell_time (column or scalar). A missing choice returns CLARIFICATION_REQUIRED with ask_user; a visit-frequency column needs visit_frequency_field or ignore_visit_frequency. seed_point_layer seeds territories from provider points (any count). part_scope: bbox_intersect (default; can be national) or explicit with part_filter, e.g. {state_abbr: TX}; accounts outside are UNASSIGNED_ACCOUNTS. part_filter {in_tal: {tal_id}} keeps a TAL's parts; {not_in_tal: {tal_id}} its white space. With map_session_id the open map is the input. Returns a task (minutes if national) with tal_id, ts_handle, and phase_timings_ms. Ends with the territory_rebalance pass; rebalancing next is redundant.

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>",
      "part_layer": "<part_layer>",
      "tal_label": "<tal_label>"
    },
    "name": "auto_build"
  }
}

Input Schema

NameRequiredDescriptionDefault
part_idsNoExplicit part selection set. Implies part_scope explicit. Mutually exclusive with part_filter.
objectiveNo
tal_labelYes
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.
build_modeNo
dwell_timeNo
part_layerYes
part_scopeNoParts eligible for partition. Default bbox_intersect: all parts intersecting the account-point bounding box. point_matched: only parts containing at least one account; those parts are rarely adjacent, so territories come back as scattered pieces (warning POINT_MATCHED_SPARSE_SCOPE) — use it only when that is the goal. explicit: part_ids or part_filter (e.g. state_abbr TX).
output_modeNotal 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_filterNoAttribute filter resolved via query_parts (e.g. {"state_abbr": "TX"}). 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_layerYes
repair_policyNoTopology 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
map_session_idNoOpen map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set.
seed_attractionNo0 = providers only pick the start; 100 = each territory stays centered on its provider. Default 70. Needs seed_point_layer.
seed_point_layerNoA second ingested point layer (service providers, offices, rep homes) that seeds the territories; each used provider names its territory.
expected_revisionNo
visit_frequency_fieldNoPoint column that scales territory workload by visits per cycle. Mutually exclusive with ignore_visit_frequency. Required as use-or-ignore when the point layer declares a visit-frequency column.
ignore_visit_frequencyNoWhen true, every account is one visit per cycle. Mutually exclusive with visit_frequency_field. Required as the ignore choice when the point layer declares a visit-frequency column.

Output Schema

NameRequiredDescriptionDefault
okYes
errorNoPresent when ok is false.
resultNoPresent when ok is true. A submission returns the task reference (task_id, next_action, sleep_ms); the completed task result carries the remaining fields.
warningsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • changedInput schema / properties / objective / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "description": "Balance objective: {metric: '<column>|__account_count__', workload_bias: 0..100, metric_bias: 0..100}. Biases sum to 100. For pure metric balance, pass {metric: '<column>', workload_bias: 0, metric_bias: 100} (or {metric: '<column>'} on restructure tools). When omitted on restructure tools, inherits the source TAL build_provenance objective or seed_build target.",
      -    "properties": {
      -      "metric": {
      -        "description": "Point metric column name to balance (e.g. 'Revenue', 'weekly_volume'), or '__account_count__' for location-count balance.",
      -        "type": "string"
      -      },
      -      "metric_bias": {
      -        "description": "Weight (0..100) on the metric or location-count dimension.",
      -        "maximum": 100,
      -        "minimum": 0,
      -        "type": "integer"
      -      },
      -      "workload_bias": {
      -        "description": "Weight (0..100) on workload (drive time + dwell).",
      -        "maximum": 100,
      -        "minimum": 0,
      -        "type": "integer"
      -      }
      -    },
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": true,
      +    "description": "Balance objective: workload_bias + metric_bias + count_bias = 100, weighting workload (drive + dwell), one metric column, and account count. Workload: {workload_bias: 100}. Metric: {metric: '<column>', workload_bias: 0, metric_bias: 100}. Count: {workload_bias: 0, count_bias: 100}. Three-way: {metric: 'Score', workload_bias: 40, metric_bias: 40, count_bias: 20}. Only one metric column balances; combine several into one score column at ingest. Omitted on restructure tools: inherits the source TAL build_provenance objective.",
      +    "properties": {
      +      "count_bias": {
      +        "description": "Weight (0..100) on account count (locations per territory). Default 0.",
      +        "maximum": 100,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "metric": {
      +        "description": "Point metric column name to balance (e.g. 'Revenue', 'Score'). Required when metric_bias > 0. Account count is count_bias, not a column.",
      +        "type": "string"
      +      },
      +      "metric_bias": {
      +        "description": "Weight (0..100) on the metric column.",
      +        "maximum": 100,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "workload_bias": {
      +        "description": "Weight (0..100) on workload (drive time + dwell).",
      +        "maximum": 100,
      +        "minimum": 0,
      +        "type": "integer"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / part_filter / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "minProperties": 1,
      -    "properties": {
      -      "county_name": {
      -        "type": [
      -          "string",
      -          "array"
      -        ]
      -      },
      -      "part_layer": {
      -        "type": "string"
      -      },
      -      "population": {
      -        "oneOf": [
      -          {
      -            "type": "number"
      -          },
      -          {
      -            "additionalProperties": false,
      -            "minProperties": 1,
      -            "properties": {
      -              "between": {
      -                "items": {
      -                  "type": "number"
      -                },
      -                "maxItems": 2,
      -                "minItems": 2,
      -                "type": "array"
      -              },
      -              "eq": {
      -                "type": "number"
      -              },
      -              "gt": {
      -                "type": "number"
      -              },
      -              "gte": {
      -                "type": "number"
      -              },
      -              "lt": {
      -                "type": "number"
      -              },
      -              "lte": {
      -                "type": "number"
      -              }
      -            },
      -            "type": "object"
      -          }
      -        ]
      -      },
      -      "spatial": {
      -        "additionalProperties": false,
      -        "oneOf": [
      -          {
      -            "required": [
      -              "bbox"
      -            ]
      -          },
      -          {
      -            "required": [
      -              "geometry"
      -            ]
      -          }
      -        ],
      -        "properties": {
      -          "bbox": {
      -            "description": "[min_lon, min_lat, max_lon, max_lat] in EPSG:4326.",
      -            "items": {
      -              "type": "number"
      -            },
      -            "maxItems": 4,
      -            "minItems": 4,
      -            "type": "array"
      -          },
      -          "geometry": {
      -            "description": "GeoJSON Polygon or MultiPolygon in EPSG:4326.",
      -            "type": "object"
      -          },
      -          "operator": {
      -            "enum": [
      -              "intersects",
      -              "within",
      -              "contains"
      -            ],
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "operator"
      -        ],
      -        "type": "object"
      -      },
      -      "state_abbr": {
      -        "type": [
      -          "string",
      -          "array"
      -        ]
      -      },
      -      "territory": {
      -        "additionalProperties": false,
      -        "oneOf": [
      -          {
      -            "required": [
      -              "ts_handle"
      -            ]
      -          },
      -          {
      -            "required": [
      -              "map_session_id"
      -            ]
      -          }
      -        ],
      -        "properties": {
      -          "include_descendants": {
      -            "default": true,
      -            "description": "When true, rollup territories include descendant leaf territory part_ids.",
      -            "type": "boolean"
      -          },
      -          "map_session_id": {
      -            "description": "Open map session whose Territory Solution holds the TAL.",
      -            "minLength": 1,
      -            "type": "string"
      -          },
      -          "tal_id": {
      -            "minLength": 1,
      -            "type": "string"
      -          },
      -          "territory_id": {
      -            "minLength": 1,
      -            "type": "string"
      -          },
      -          "ts_handle": {
      -            "description": "Territory Solution reference (tsh_...) holding the TAL (no inline TS).",
      -            "minLength": 1,
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "tal_id",
      -          "territory_id"
      -        ],
      -        "type": "object"
      -      },
      -      "text": {
      -        "additionalProperties": false,
      -        "properties": {
      -          "case_sensitive": {
      -            "default": false,
      -            "type": "boolean"
      -          },
      -          "field": {
      -            "description": "Safe text field to search. Defaults to the public part ID column.",
      -            "type": "string"
      -          },
      -          "mode": {
      -            "default": "prefix",
      -            "enum": [
      -              "prefix",
      -              "contains",
      -              "exact"
      -            ],
      -            "type": "string"
      -          },
      -          "value": {
      -            "minLength": 1,
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "value"
      -        ],
      -        "type": "object"
      -      }
      -    },
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": true,
      +    "minProperties": 1,
      +    "properties": {
      +      "county_name": {
      +        "type": [
      +          "string",
      +          "array"
      +        ]
      +      },
      +      "in_tal": {
      +        "additionalProperties": false,
      +        "description": "Keep only the parts assigned to a leaf territory of tal_id: the TAL's whole footprint, however many separate regions it has. ANDed with the other predicates (alone it is exactly that footprint). The TAL must use the same part_layer and hold parts. query_parts needs ts_handle or map_session_id here; builds read the TAL from the build's own Territory Solution.",
      +        "properties": {
      +          "map_session_id": {
      +            "description": "query_parts only: open map session whose Territory Solution holds the TAL.",
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "tal_id": {
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "territory_ids": {
      +            "description": "Narrow to these territory_id values (not display labels); a rollup includes every leaf below it. Unknown ids return UNKNOWN_TERRITORY_ID with available_territory_ids.",
      +            "items": {
      +              "minLength": 1,
      +              "type": "string"
      +            },
      +            "minItems": 1,
      +            "type": "array"
      +          },
      +          "ts_handle": {
      +            "description": "query_parts only: Territory Solution reference (tsh_...) holding the TAL.",
      +            "minLength": 1,
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "tal_id"
      +        ],
      +        "type": "object"
      +      },
      +      "not_in_tal": {
      +        "additionalProperties": false,
      +        "description": "White space: drop every part assigned to a leaf territory of tal_id from whatever the other predicates select (the whole layer when alone). The TAL must use the same part_layer. query_parts needs ts_handle or map_session_id here; builds read the TAL from the build's own Territory Solution.",
      +        "properties": {
      +          "map_session_id": {
      +            "description": "query_parts only: open map session whose Territory Solution holds the TAL.",
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "tal_id": {
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "ts_handle": {
      +            "description": "query_parts only: Territory Solution reference (tsh_...) holding the TAL.",
      +            "minLength": 1,
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "tal_id"
      +        ],
      +        "type": "object"
      +      },
      +      "part_layer": {
      +        "type": "string"
      +      },
      +      "population": {
      +        "oneOf": [
      +          {
      +            "type": "number"
      +          },
      +          {
      +            "additionalProperties": false,
      +            "minProperties": 1,
      +            "properties": {
      +              "between": {
      +                "items": {
      +                  "type": "number"
      +                },
      +                "maxItems": 2,
      +                "minItems": 2,
      +                "type": "array"
      +              },
      +              "eq": {
      +                "type": "number"
      +              },
      +              "gt": {
      +                "type": "number"
      +              },
      +              "gte": {
      +                "type": "number"
      +              },
      +              "lt": {
      +                "type": "number"
      +              },
      +              "lte": {
      +                "type": "number"
      +              }
      +            },
      +            "type": "object"
      +          }
      +        ]
      +      },
      +      "selection_task_id": {
      +        "description": "Builds only (auto_build, account_build, seed_build): a committed request_part_selection task (psel_...) whose part_ids become the scope; it is the only key in that part_filter.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "spatial": {
      +        "additionalProperties": false,
      +        "oneOf": [
      +          {
      +            "required": [
      +              "bbox"
      +            ]
      +          },
      +          {
      +            "required": [
      +              "geometry"
      +            ]
      +          }
      +        ],
      +        "properties": {
      +          "bbox": {
      +            "description": "[min_lon, min_lat, max_lon, max_lat] in EPSG:4326.",
      +            "items": {
      +              "type": "number"
      +            },
      +            "maxItems": 4,
      +            "minItems": 4,
      +            "type": "array"
      +          },
      +          "geometry": {
      +            "description": "GeoJSON Polygon or MultiPolygon in EPSG:4326.",
      +            "type": "object"
      +          },
      +          "operator": {
      +            "enum": [
      +              "intersects",
      +              "within",
      +              "contains"
      +            ],
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "operator"
      +        ],
      +        "type": "object"
      +      },
      +      "state_abbr": {
      +        "type": [
      +          "string",
      +          "array"
      +        ]
      +      },
      +      "text": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "case_sensitive": {
      +            "default": false,
      +            "type": "boolean"
      +          },
      +          "field": {
      +            "description": "Safe text field to search. Defaults to the public part ID column.",
      +            "type": "string"
      +          },
      +          "mode": {
      +            "default": "prefix",
      +            "enum": [
      +              "prefix",
      +              "contains",
      +              "exact"
      +            ],
      +            "type": "string"
      +          },
      +          "value": {
      +            "minLength": 1,
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "value"
      +        ],
      +        "type": "object"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / part_filter / description
      Previous value: -"Attribute filter resolved via query_parts (e.g. {\"state_abbr\": \"TX\"}). Implies part_scope explicit. Mutually exclusive with part_ids."New value: +"Attribute filter resolved via query_parts (e.g. {\"state_abbr\": \"TX\"}). 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."
    • addedInput schema / properties / seed_attraction
      Added value: +{
      +  "anyOf": [
      +    {
      +      "maximum": 100,
      +      "minimum": 0,
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "0 = providers only pick the start; 100 = each territory stays centered on its provider. Default 70. Needs seed_point_layer.",
      +  "title": "Seed Attraction"
      +}
    • addedInput schema / properties / seed_point_layer
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "A second ingested point layer (service providers, offices, rep homes) that seeds the territories; each used provider names its territory.",
      +  "title": "Seed Point Layer"
      +}
    • addedOutput schema / properties / result / properties / seed_summary
      Added value: +{
      +  "type": "object"
      +}
  2. Changed3 schema fields changed
    • changedInput schema / properties / build_mode / anyOf
      Previous value: -[
      -  {
      -    "oneOf": [
      -      {
      -        "additionalProperties": false,
      -        "properties": {
      -          "mode": {
      -            "const": "fixed_territory_count"
      -          },
      -          "territory_count": {
      -            "minimum": 1,
      -            "type": "integer"
      -          }
      -        },
      -        "required": [
      -          "mode",
      -          "territory_count"
      -        ],
      -        "type": "object"
      -      },
      -      {
      -        "additionalProperties": false,
      -        "properties": {
      -          "cycle_unit": {
      -            "enum": [
      -              "day",
      -              "week",
      -              "month",
      -              "quarter",
      -              "year"
      -            ],
      -            "type": "string"
      -          },
      -          "mode": {
      -            "const": "fixed_workload_target"
      -          },
      -          "target_workload": {
      -            "exclusiveMinimum": 0,
      -            "type": "number"
      -          },
      -          "workload_unit": {
      -            "enum": [
      -              "minutes",
      -              "hours"
      -            ],
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "mode",
      -          "target_workload"
      -        ],
      -        "type": "object"
      -      },
      -      {
      -        "additionalProperties": false,
      -        "properties": {
      -          "mode": {
      -            "const": "scoped_split"
      -          },
      -          "preserve_other_territories": {
      -            "const": true,
      -            "default": true
      -          },
      -          "replacement_territory_count": {
      -            "minimum": 2,
      -            "type": "integer"
      -          },
      -          "source_tal_id": {
      -            "minLength": 1,
      -            "type": "string"
      -          },
      -          "source_territory_id": {
      -            "minLength": 1,
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "mode",
      -          "source_tal_id",
      -          "source_territory_id",
      -          "replacement_territory_count"
      -        ],
      -        "type": "object"
      -      }
      -    ]
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": true,
      +    "description": "Sizing mode: {mode: 'fixed_territory_count', territory_count: <int>} or {mode: 'fixed_workload_target', target_workload: <number>, workload_unit: 'hours'|'minutes', optional cycle_unit: 'day'|'week'|'month'|'quarter'|'year'} or {mode: 'scoped_split', source_tal_id: '<tal_id>', source_territory_id: '<territory_id>', replacement_territory_count: <int>=2.., optional preserve_other_territories: true}.",
      +    "properties": {
      +      "cycle_unit": {
      +        "description": "Optional schedule cycle unit for fixed_workload_target.",
      +        "enum": [
      +          "day",
      +          "week",
      +          "month",
      +          "quarter",
      +          "year"
      +        ],
      +        "type": "string"
      +      },
      +      "mode": {
      +        "description": "Sizing mode for the build.",
      +        "enum": [
      +          "fixed_territory_count",
      +          "fixed_workload_target",
      +          "scoped_split"
      +        ],
      +        "type": "string"
      +      },
      +      "preserve_other_territories": {
      +        "default": true,
      +        "description": "Keep all other territories in source_tal_id unchanged when mode='scoped_split'.",
      +        "type": "boolean"
      +      },
      +      "replacement_territory_count": {
      +        "description": "Number of replacement territories (>=2) when mode='scoped_split'.",
      +        "minimum": 2,
      +        "type": "integer"
      +      },
      +      "source_tal_id": {
      +        "description": "Source TAL id when mode='scoped_split'.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "source_territory_id": {
      +        "description": "Source territory id or label to split when mode='scoped_split'.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "target_workload": {
      +        "description": "Target workload per territory when mode='fixed_workload_target'.",
      +        "exclusiveMinimum": 0,
      +        "type": "number"
      +      },
      +      "territory_count": {
      +        "description": "Target number of territories when mode='fixed_territory_count'.",
      +        "minimum": 1,
      +        "type": "integer"
      +      },
      +      "workload_unit": {
      +        "default": "hours",
      +        "description": "Unit for target_workload ('hours' or 'minutes').",
      +        "enum": [
      +          "minutes",
      +          "hours"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "mode"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / build_mode / description
      Removed value: -"Required for execution unless a form-capable modern client answers sizing via Resolve/Elicit. Legacy/no-capability hosts still receive CLARIFICATION_REQUIRED when omitted."
    • addedInput schema / properties / build_mode / title
      Added value: +"Build Mode"
  3. Changed1 schema field changed
    • changedInput schema / properties / part_scope / description
      Previous value: -"Parts eligible for partition. Default bbox_intersect: all parts intersecting the account-point bounding box. point_matched: only parts containing at least one account. explicit: part_ids or part_filter (e.g. state_abbr TX)."New value: +"Parts eligible for partition. Default bbox_intersect: all parts intersecting the account-point bounding box. point_matched: only parts containing at least one account; those parts are rarely adjacent, so territories come back as scattered pieces (warning POINT_MATCHED_SPARSE_SCOPE) — use it only when that is the goal. explicit: part_ids or part_filter (e.g. state_abbr TX)."
  4. Changed17 schema fields changed
    • changedInput schema / properties / build_mode / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "oneOf": [
      +      {
      +        "additionalProperties": false,
      +        "properties": {
      +          "mode": {
      +            "const": "fixed_territory_count"
      +          },
      +          "territory_count": {
      +            "minimum": 1,
      +            "type": "integer"
      +          }
      +        },
      +        "required": [
      +          "mode",
      +          "territory_count"
      +        ],
      +        "type": "object"
      +      },
      +      {
      +        "additionalProperties": false,
      +        "properties": {
      +          "cycle_unit": {
      +            "enum": [
      +              "day",
      +              "week",
      +              "month",
      +              "quarter",
      +              "year"
      +            ],
      +            "type": "string"
      +          },
      +          "mode": {
      +            "const": "fixed_workload_target"
      +          },
      +          "target_workload": {
      +            "exclusiveMinimum": 0,
      +            "type": "number"
      +          },
      +          "workload_unit": {
      +            "enum": [
      +              "minutes",
      +              "hours"
      +            ],
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "mode",
      +          "target_workload"
      +        ],
      +        "type": "object"
      +      },
      +      {
      +        "additionalProperties": false,
      +        "properties": {
      +          "mode": {
      +            "const": "scoped_split"
      +          },
      +          "preserve_other_territories": {
      +            "const": true,
      +            "default": true
      +          },
      +          "replacement_territory_count": {
      +            "minimum": 2,
      +            "type": "integer"
      +          },
      +          "source_tal_id": {
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "source_territory_id": {
      +            "minLength": 1,
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "mode",
      +          "source_tal_id",
      +          "source_territory_id",
      +          "replacement_territory_count"
      +        ],
      +        "type": "object"
      +      }
      +    ]
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / build_mode / description
      Added value: +"Required for execution unless a form-capable modern client answers sizing via Resolve/Elicit. Legacy/no-capability hosts still receive CLARIFICATION_REQUIRED when omitted."
    • removedInput schema / properties / build_mode / title
      Removed value: -"Build Mode"
    • addedInput schema / properties / ignore_visit_frequency / description
      Added value: +"When true, every account is one visit per cycle. Mutually exclusive with visit_frequency_field. Required as the ignore choice when the point layer declares a visit-frequency column."
    • 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."
    • changedInput schema / properties / part_filter / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": true,
      +    "minProperties": 1,
      +    "properties": {
      +      "county_name": {
      +        "type": [
      +          "string",
      +          "array"
      +        ]
      +      },
      +      "part_layer": {
      +        "type": "string"
      +      },
      +      "population": {
      +        "oneOf": [
      +          {
      +            "type": "number"
      +          },
      +          {
      +            "additionalProperties": false,
      +            "minProperties": 1,
      +            "properties": {
      +              "between": {
      +                "items": {
      +                  "type": "number"
      +                },
      +                "maxItems": 2,
      +                "minItems": 2,
      +                "type": "array"
      +              },
      +              "eq": {
      +                "type": "number"
      +              },
      +              "gt": {
      +                "type": "number"
      +              },
      +              "gte": {
      +                "type": "number"
      +              },
      +              "lt": {
      +                "type": "number"
      +              },
      +              "lte": {
      +                "type": "number"
      +              }
      +            },
      +            "type": "object"
      +          }
      +        ]
      +      },
      +      "spatial": {
      +        "additionalProperties": false,
      +        "oneOf": [
      +          {
      +            "required": [
      +              "bbox"
      +            ]
      +          },
      +          {
      +            "required": [
      +              "geometry"
      +            ]
      +          }
      +        ],
      +        "properties": {
      +          "bbox": {
      +            "description": "[min_lon, min_lat, max_lon, max_lat] in EPSG:4326.",
      +            "items": {
      +              "type": "number"
      +            },
      +            "maxItems": 4,
      +            "minItems": 4,
      +            "type": "array"
      +          },
      +          "geometry": {
      +            "description": "GeoJSON Polygon or MultiPolygon in EPSG:4326.",
      +            "type": "object"
      +          },
      +          "operator": {
      +            "enum": [
      +              "intersects",
      +              "within",
      +              "contains"
      +            ],
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "operator"
      +        ],
      +        "type": "object"
      +      },
      +      "state_abbr": {
      +        "type": [
      +          "string",
      +          "array"
      +        ]
      +      },
      +      "territory": {
      +        "additionalProperties": false,
      +        "oneOf": [
      +          {
      +            "required": [
      +              "ts_handle"
      +            ]
      +          },
      +          {
      +            "required": [
      +              "map_session_id"
      +            ]
      +          }
      +        ],
      +        "properties": {
      +          "include_descendants": {
      +            "default": true,
      +            "description": "When true, rollup territories include descendant leaf territory part_ids.",
      +            "type": "boolean"
      +          },
      +          "map_session_id": {
      +            "description": "Open map session whose Territory Solution holds the TAL.",
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "tal_id": {
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "territory_id": {
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "ts_handle": {
      +            "description": "Territory Solution reference (tsh_...) holding the TAL (no inline TS).",
      +            "minLength": 1,
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "tal_id",
      +          "territory_id"
      +        ],
      +        "type": "object"
      +      },
      +      "text": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "case_sensitive": {
      +            "default": false,
      +            "type": "boolean"
      +          },
      +          "field": {
      +            "description": "Safe text field to search. Defaults to the public part ID column.",
      +            "type": "string"
      +          },
      +          "mode": {
      +            "default": "prefix",
      +            "enum": [
      +              "prefix",
      +              "contains",
      +              "exact"
      +            ],
      +            "type": "string"
      +          },
      +          "value": {
      +            "minLength": 1,
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "value"
      +        ],
      +        "type": "object"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / part_filter / description
      Added value: +"Attribute filter resolved via query_parts (e.g. {\"state_abbr\": \"TX\"}). Implies part_scope explicit. Mutually exclusive with part_ids."
    • removedInput schema / properties / part_filter / title
      Removed value: -"Part Filter"
    • addedInput schema / properties / part_ids / description
      Added value: +"Explicit part selection set. Implies part_scope explicit. Mutually exclusive with part_filter."
    • addedInput schema / properties / part_scope / description
      Added value: +"Parts eligible for partition. Default bbox_intersect: all parts intersecting the account-point bounding box. point_matched: only parts containing at least one account. explicit: part_ids or part_filter (e.g. state_abbr TX)."
    • removedInput schema / properties / ts
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Ts"
      -}
    • addedInput schema / properties / 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."
    • addedInput schema / properties / visit_frequency_field / description
      Added value: +"Point column that scales territory workload by visits per cycle. Mutually exclusive with ignore_visit_frequency. Required as use-or-ignore when the point layer declares a visit-frequency column."
    • 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. A submission returns the task reference (task_id, next_action, sleep_ms); the completed task result carries the remaining fields.",
      +    "properties": {
      +      "assignment_count": {
      +        "type": "integer"
      +      },
      +      "assignments_artifact": {
      +        "type": "object"
      +      },
      +      "build_mode_summary": {
      +        "type": "object"
      +      },
      +      "distribution_summary": {
      +        "type": "object"
      +      },
      +      "do_this_next": {
      +        "type": [
      +          "object",
      +          "string"
      +        ]
      +      },
      +      "download_url": {
      +        "type": "string"
      +      },
      +      "expires_at": {
      +        "type": "string"
      +      },
      +      "job_id": {
      +        "type": "string"
      +      },
      +      "next_action": {
      +        "type": "string"
      +      },
      +      "objective_summary": {
      +        "type": "object"
      +      },
      +      "output_mode": {
      +        "type": "string"
      +      },
      +      "part_scope_summary": {
      +        "type": "object"
      +      },
      +      "phase_timings_ms": {
      +        "type": "object"
      +      },
      +      "scoped_split_summary": {
      +        "type": "object"
      +      },
      +      "sleep_ms": {
      +        "type": "integer"
      +      },
      +      "status": {
      +        "type": "string"
      +      },
      +      "tal_id": {
      +        "type": "string"
      +      },
      +      "task_id": {
      +        "type": "string"
      +      },
      +      "terminal": {
      +        "type": "boolean"
      +      },
      +      "territory_count": {
      +        "type": "integer"
      +      },
      +      "ts_handle": {
      +        "type": "string"
      +      },
      +      "ts_identity": {
      +        "type": "object"
      +      },
      +      "ts_omitted": {
      +        "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: -"auto_buildDictOutput"
  5. Changed1 schema field changed
    • changedInput schema / properties / output_mode / description
      Previous value: -"tal is the default. assignments returns assignments_artifact plus an authenticated download_url; no ts_handle, tal_id, or map_refresh."New value: +"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."
  6. Changed1 schema field changed
    • changedInput schema / properties / objective / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": true,
      +    "description": "Balance objective: {metric: '<column>|__account_count__', workload_bias: 0..100, metric_bias: 0..100}. Biases sum to 100. For pure metric balance, pass {metric: '<column>', workload_bias: 0, metric_bias: 100} (or {metric: '<column>'} on restructure tools). When omitted on restructure tools, inherits the source TAL build_provenance objective or seed_build target.",
      +    "properties": {
      +      "metric": {
      +        "description": "Point metric column name to balance (e.g. 'Revenue', 'weekly_volume'), or '__account_count__' for location-count balance.",
      +        "type": "string"
      +      },
      +      "metric_bias": {
      +        "description": "Weight (0..100) on the metric or location-count dimension.",
      +        "maximum": 100,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "workload_bias": {
      +        "description": "Weight (0..100) on workload (drive time + dwell).",
      +        "maximum": 100,
      +        "minimum": 0,
      +        "type": "integer"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  7. Changed1 schema field changed
    • changedInput schema / properties / dwell_time / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": true,
      +    "description": "Onsite (dwell) time per visit: {type: 'scalar', value: <number>, unit: 'minutes'|'hours'} or {type: 'field', field: '<column>', unit: 'minutes'|'hours'}.",
      +    "properties": {
      +      "field": {
      +        "description": "Point column name holding per-account onsite time when type='field'.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "type": {
      +        "description": "Dwell source: 'scalar' for a fixed per-visit duration or 'field' for an ingested point column.",
      +        "enum": [
      +          "scalar",
      +          "field"
      +        ],
      +        "type": "string"
      +      },
      +      "unit": {
      +        "default": "minutes",
      +        "description": "Time unit for value or field ('minutes' or 'hours').",
      +        "enum": [
      +          "minutes",
      +          "hours"
      +        ],
      +        "type": "string"
      +      },
      +      "value": {
      +        "description": "Confirmed onsite duration per visit when type='scalar'.",
      +        "minimum": 0,
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "type"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  8. Changed1 schema field changed
    • removedInput schema / properties / guidance_handle
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Guidance Handle"
      -}
  9. Changed2 schema fields changed
    • addedInput schema / properties / repair_policy / description
      Added value: +"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."
    • addedInput schema / properties / repair_policy / enum
      Added value: +[
      +  "default",
      +  "strict",
      +  "report_only"
      +]
  10. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations, the description discloses that the tool returns a task with tal_id, ts_handle, and phase_timings_ms, that national builds can take minutes, that missing choices produce CLARIFICATION_REQUIRED with ask_user, and that accounts outside the part scope become UNASSIGNED_ACCOUNTS. It also states that the build ends with the territory_rebalance pass, which prevents an unnecessary follow-up call.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The definition is front-loaded and every sentence carries substantive requirements, which is appropriate for an 18-parameter build tool. However, it is a dense single paragraph with compressed clauses and abbreviations that could be easier to scan as structured bullets.

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?

For a complex territory-build tool with an output schema and safety annotations, the description covers the core workflow, clarification behavior, scoping rules, TAL footprint/white-space filtering, runtime expectations, and return shape. Remaining details such as repair_policy and expected_revision are documented in the schema rather than needing repetition here.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaning for the highest-impact parameters: build_mode variants, objective weights summing to 100, dwell_time as column or scalar, seed_point_layer provider seeding, part_scope behavior, and inclusive/exclusive TAL part filters. With 61% schema coverage, some parameters such as expected_revision, repair_policy, output_mode, and seed_attraction are left mostly to the schema descriptions.

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: partitioning ingested accounts into balanced sales territories as a new TAL over a part layer. It also explicitly distinguishes the tool from territory_rebalance by saying rebalancing next is redundant, so an agent can identify the operation and one key sibling boundary.

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 gives clear operational guidance: missing required choices trigger CLARIFICATION_REQUIRED, a visit-frequency column requires visit_frequency_field or ignore_visit_frequency, part_scope defaults to bbox_intersect, and rebalancing afterward is unnecessary. It does not explain when to choose auto_build over the other build siblings such as account_build, direct_build, isochrone_build, or seed_build.

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