Skip to main content
Glama
GIS MCP Server
by mahdin75

knn_weights

Build k-nearest-neighbor spatial weights from point coordinates to model local spatial relationships in GIS analysis.

Instructions

Build k-nearest-neighbor spatial weights from point coordinates.

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": {
      "data_path": "<data_path>",
      "k": "<k>"
    },
    "name": "knn_weights"
  }
}

Input Schema

NameRequiredDescriptionDefault
kYes
id_fieldNo
data_pathYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.16.0
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "type": "object"
      -}New value: +null
  2. Changed5 schema fields changedv1.0.0
    • removedInput schema / properties / data_path / title
      Removed value: -"Data Path"
    • removedInput schema / properties / id_field / title
      Removed value: -"Id Field"
    • removedInput schema / properties / k / title
      Removed value: -"K"
    • removedInput schema / title
      Removed value: -"knn_weightsArguments"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
  3. First observed

TDQS

C2.6/5.0
Behavior2/5

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

With no annotations supplied, the description carries the full behavioral burden, yet it says nothing about whether weights are row-standardized or binary, whether the neighbor relation is symmetric, whether self-neighbors are included, or what the tool returns. For a spatial-weights constructor these are exactly the traits an agent must know before invoking it.

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?

A single front-loaded sentence with no filler or repetition. It is efficient, though the brevity comes at the cost of the specification gaps noted in the other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with three parameters, two required, no annotations, and no output schema, the description is too thin. It omits the return type of the weights object, whether the result is a matrix or a neighbor list, and any error or standardization behavior, leaving the agent under-informed relative to the tool's complexity.

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

Parameters1/5

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

Schema description coverage is 0% for all three parameters. The description only indirectly hints that 'k' is the neighbor count and 'data_path' points to coordinates; it never explains the type of 'data_path', what 'id_field' is for (presumably an identifier column for the weights index), or what happens when 'id_field' is null.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb ('Build') plus a precise resource ('k-nearest-neighbor spatial weights') and names the input ('point coordinates'), so an agent immediately knows what operation this performs. It stops short of differentiating itself from the visible alternative distance_band_weights, leaving the agent to infer the distinction between KNN and distance-band weighting.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit when-to-use or when-not-to-use guidance, and no mention of the sibling weight-building tools such as distance_band_weights or weights_from_shapefile. The phrase 'from point coordinates' weakly implies the input precondition, but nothing tells the agent when KNN is the correct weighting scheme versus another.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.