Skip to main content
Glama

Create Territory from Parts

create_territory_from_parts

Creates one leaf territory from a list of part_ids (e.g. a committed map selection), in a new alignment or an existing one (tal_id). With map_session_id the live map's Territory Solution is updated and repainted; otherwise ts_handle (a new ts_handle is returned). map_session_id wins when both are passed. territory_name is a display label; the result's created_territory.territory_id is the stable id for later edits, plus leaf_territories and selection_summary (duplicate_part_ids). Dwell is optional here and is not inherited from an earlier auto_build; dwell_time is recorded for later analyze. Without it, analyze reports every statistic except workload and returns workload_omitted.ask_user. Returns a task.

Input Schema

NameRequiredDescriptionDefault
tal_idNoExisting TAL to append the new territory to; omit to start a new alignment.
part_idsYesParts for the new territory, e.g. committed part_ids from get_part_selection.
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.
dwell_timeNo
part_layerYes
repair_policyNoTopology repair policy for dissolved geometry (default, strict, or report_only). Interior holes occupied by existing territories in the TS are never filled.
map_session_idNoOpen map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set.
territory_nameYes
territory_pathNo
conflict_policyNo

Output Schema

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

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changed
    • 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."
    • addedInput schema / properties / part_ids / description
      Added value: +"Parts for the new territory, e.g. committed part_ids from get_part_selection."
    • addedInput schema / properties / repair_policy / description
      Added value: +"Topology repair policy for dissolved geometry (default, strict, or report_only). Interior holes occupied by existing territories in the TS are never filled."
    • addedInput schema / properties / tal_id / description
      Added value: +"Existing TAL to append the new territory to; omit to start a new alignment."
    • 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."
    • 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.",
      +    "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: -"create_territory_from_partsDictOutput"
  2. Changed2 schema fields 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"
      +  }
      +]
    • addedInput schema / properties / repair_policy
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Repair Policy"
      +}
  3. Changed1 schema field changed
    • removedInput schema / properties / guidance_handle
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Guidance Handle"
      -}
  4. Changed1 schema field changed
    • addedInput schema / properties / ts_handle
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Ts Handle"
      +}
  5. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the annotations (destructiveHint=false, idempotentHint=false) by disclosing precedence between map_session_id and ts_handle, the side effect of repainting the live map, the async 'Returns a task' behavior, and the downstream consequence that omitting dwell_time makes analyze return workload_omitted.ask_user. These are non-obvious traits an agent could not infer from structured fields.

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?

Front-loads the core action and keeps nearly every clause informative, including the precedence rule and the dwell/analyze consequence. It is dense and somewhat run-on, packing multiple concepts into long sentences, but little is wasted.

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?

An output schema exists, yet the description still usefully orients the agent to created_territory.territory_id and selection_summary.duplicate_part_ids, and it covers the main behavioral pitfalls. The unexplained part_layer and conflict_policy parameters are the remaining gap for a 10-parameter mutation tool.

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?

With only 50% schema coverage, the description compensates for several key params: tal_id as new-vs-existing alignment, ts_handle provenance and that a new handle is returned, territory_name as a mere display label versus the stable created_territory.territory_id, and dwell_time semantics. It leaves part_layer, territory_path, and conflict_policy unexplained, so it does not fully close the gap.

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?

States a specific verb and resource ('Creates one leaf territory from a list of part_ids'), plus the scope constraint that it produces a single leaf territory. This clearly distinguishes it from sibling builders like auto_build, direct_build, and territory_split.

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?

Gives concrete routing rules: use map_session_id to update/repaint the live map, otherwise pass ts_handle, and map_session_id wins when both are supplied. It also notes dwell_time is optional and not inherited from an earlier auto_build. It stops short of naming an alternative tool to prefer in specific scenarios, so it falls just under a 5.

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