Skip to main content
Glama

Points in Territory

points_in_territory
Read-onlyIdempotent

Lists which account points from one point layer fall inside a territory polygon or a drive-time (isochrone) area. Per territory: point_count, metric_sums (metrics, else the layer's declared metric fields), and a sample of sample_size points (default 25, max 200; 500 across all territories) with label and metric fields, or only the fields you name. Counts and sums cover every inside point. The full list is never inline: it is in points_artifact, via download_url (GET with the API key) or share_with_user (one-hour key-less link for the user). Synchronous, read-only; needs map_session_id or ts_handle. territory_id names one leaf (id or unique display name), territory_ids several; omit both for every leaf in the TAL (tal_id, else the active or sole TAL). point_layer defaults to the sole layer with points; point_filter (e.g. {tier: 'Gold'}) filters before counting. A point counts in every containing polygon; overlaps lists shared points. Unknown ids return UNKNOWN_TAL_ID / UNKNOWN_TERRITORY_ID / UNKNOWN_POINT_LAYER with the available values.

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": "points_in_territory"
  }
}

Input Schema

NameRequiredDescriptionDefault
fieldsNoPoint properties to keep on sample points and in points_artifact. Omitted: the sample carries label plus the metric fields, and the artifact carries every property.
tal_idNoTerritory alignment to query. Defaults to the active TAL, or the sole TAL with leaf polygons.
metricsNoNumeric point columns to sum per territory. Defaults to the layer's declared metric fields.
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.
point_layerNoPoint layer id or exact unique label. Optional when the solution has one layer with points.
sample_sizeNoPoints shown inline per territory; the server lowers it so at most 500 sample points come back across all territories. point_count and metric_sums always cover every inside point; points_artifact lists them all.
point_filterNoOptional attribute filter (column -> value or list of values, matched case-insensitively, e.g. {"tier": "Gold"}) applied to the point layer before counting and listing.
territory_idNoOne leaf: its stable territory_id or exact unique display name. Mutually exclusive with territory_ids.
territory_idsNoSeveral leaves (stable ids or exact unique display names). With neither territory_id nor territory_ids, every leaf in the TAL.
map_session_idNoOpen map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set.

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 / fields
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Point properties to keep on sample points and in points_artifact. Omitted: the sample carries label plus the metric fields, and the artifact carries every property.",
      +  "title": "Fields"
      +}
    • removedInput schema / properties / max_points
      Removed value: -{
      -  "default": 1000,
      -  "description": "Cap on points listed per territory. point_count and metric_sums always cover every inside point.",
      -  "title": "Max Points",
      -  "type": "integer"
      -}
    • addedInput schema / properties / sample_size
      Added value: +{
      +  "default": 25,
      +  "description": "Points shown inline per territory; the server lowers it so at most 500 sample points come back across all territories. point_count and metric_sums always cover every inside point; points_artifact lists them all.",
      +  "title": "Sample Size",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / result / properties / download_url
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / result / properties / points_artifact
      Added value: +{
      +  "type": "object"
      +}
    • addedOutput schema / properties / result / properties / sample_fields
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / result / properties / sample_size_applied
      Added value: +{
      +  "type": "integer"
      +}
    • addedOutput schema / properties / result / properties / share_url
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / result / properties / share_url_expires_at
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / result / properties / share_with_user
      Added value: +{
      +  "type": "string"
      +}
  2. Changed15 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 / max_points / description
      Added value: +"Cap on points listed per territory. point_count and metric_sums always cover every inside point."
    • addedInput schema / properties / metrics / description
      Added value: +"Numeric point columns to sum per territory. Defaults to the layer's declared metric fields."
    • changedInput schema / properties / point_filter / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": {
      +      "anyOf": [
      +        {
      +          "type": [
      +            "string",
      +            "number",
      +            "boolean"
      +          ]
      +        },
      +        {
      +          "items": {
      +            "type": [
      +              "string",
      +              "number",
      +              "boolean"
      +            ]
      +          },
      +          "minItems": 1,
      +          "type": "array"
      +        }
      +      ]
      +    },
      +    "minProperties": 1,
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / point_filter / description
      Added value: +"Optional attribute filter (column -> value or list of values, matched case-insensitively, e.g. {\"tier\": \"Gold\"}) applied to the point layer before counting and listing."
    • removedInput schema / properties / point_filter / title
      Removed value: -"Point Filter"
    • addedInput schema / properties / point_layer / description
      Added value: +"Point layer id or exact unique label. Optional when the solution has one layer with points."
    • addedInput schema / properties / tal_id / description
      Added value: +"Territory alignment to query. Defaults to the active TAL, or the sole TAL with leaf polygons."
    • addedInput schema / properties / territory_id / description
      Added value: +"One leaf: its stable territory_id or exact unique display name. Mutually exclusive with territory_ids."
    • addedInput schema / properties / territory_ids / description
      Added value: +"Several leaves (stable ids or exact unique display names). With neither territory_id nor territory_ids, every leaf in the TAL."
    • 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.",
      +    "properties": {
      +      "counting": {
      +        "type": "string"
      +      },
      +      "do_this_next": {
      +        "type": "string"
      +      },
      +      "overlap_point_count": {
      +        "type": "integer"
      +      },
      +      "overlaps": {
      +        "items": {
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "point_layer": {
      +        "type": "string"
      +      },
      +      "tal_id": {
      +        "type": "string"
      +      },
      +      "tal_kind": {
      +        "type": "string"
      +      },
      +      "territories": {
      +        "items": {
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "totals": {
      +        "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: -"points_in_territoryDictOutput"
  3. Changed1 schema field changed
    • addedInput schema / properties / point_filter
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Point Filter"
      +}
  4. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already cover read-only/idempotent, but the description goes further: synchronous execution, the full point list is never inline and must be fetched from points_artifact via download_url (GET with API key) or the one-hour key-less share_with_user link, plus the 500-sample cap and specific UNKNOWN_* error codes with remediation. This is unusually rich behavioral disclosure.

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?

Purpose is front-loaded in the first sentence and the paragraph follows a logical order (outputs, artifact, preconditions, selectors, errors). It is a dense, semicolon-chained block with some repetition of schema defaults (sample_size 25/200/500, territory_id exclusivity), costing a point.

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 10-parameter tool with an output schema, the description still covers what matters: the inline vs artifact split, the async-free synchronous nature, required inputs (map_session_id or ts_handle), and error behavior. Nothing an agent needs to call it correctly is missing.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds real semantics: territory_id and territory_ids are alternatives, tal_id falls back to active/sole TAL, point_filter applies before counting, and a point counts in every containing polygon (surfaced via overlaps). It mostly reinforces rather than replaces the schema.

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: lists which account points from a point layer fall inside a territory polygon or isochrone area. It clearly delimits scope (per-territory counts, sums, samples) so an agent can separate it from siblings like cluster_points or query_parts.

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 selection rules: territory_id for one leaf, territory_ids for several, omit both for every leaf in the TAL, point_layer defaults to the sole layer with points. It doesn't name alternative sibling tools for overlapping use cases, so it stops short of full when/when-not guidance.

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