Skip to main content
Glama

Spatial Join

spatial_join

Join attributes from one layer to another by spatial relationship using predicates such as intersects, contains, or within. Select match method and copied fields to enrich target features.

Instructions

Join attributes by location (native:joinattributesbylocation). predicates int list: 0=intersects 1=contains 2=equals 3=touches 4=overlaps 5=within 6=crosses (default [0]). method: 0=one-to-many 1=first match (default) 2=largest overlap. First match keeps one arbitrary match per target feature and drops the others; use 0 when several can match. join_fields = copied columns (default all). No output_path = in-memory layer. Returns joined_count (target features that found a match, whatever the method) next to target_features. warnings/warning_count report features QGIS skipped, e.g. invalid geometries under the Processing setting that skips them; fix them first (native:fixgeometries) or those features never match.

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": {
      "target_layer": "<target_layer>",
      "join_layer": "<join_layer>"
    },
    "name": "spatial_join"
  }
}

Input Schema

NameRequiredDescriptionDefault
methodNo
prefixNo
join_layerYes
predicatesNo
join_fieldsNo
output_pathNo
target_layerYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations, the description carries the full burden, and it is exceptionally transparent: it documents first-match arbitrary tie-breaking, in-memory output when output_path is omitted, the joined_count/target_features return shape, and warnings about skipped invalid geometries with a remediation hint (native:fixgeometries).

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

Conciseness5/5

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

The text is dense but every clause earns its place: parameter mappings, default behavior, output, and warnings are packed in without filler. The most decision-relevant information is front-loaded rather than buried.

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 7-parameter, no-output-schema tool with zero annotation support, this covers essentially everything needed to call it correctly: optional parameters, output behavior, return value, warnings, and failure causes. The minor omission of prefix is not enough to block a correct call.

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 0%, so the description must compensate; it explains the numeric predicate/method mappings, defaults, join_fields, and output_path semantics. However, prefix is never described, and the stated predicates default [0] conflicts slightly with the schema's null default, leaving a small ambiguity.

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-resource statement, 'Join attributes by location', which clearly identifies the tool as a spatial join and distinguishes it from attribute-based joins like add_table_join. Naming the underlying algorithm (native:joinattributesbylocation) removes ambiguity about what operation is wrapped.

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

Usage Guidelines3/5

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

Usage is implied rather than explicit: it does not explicitly route the agent to or away from sibling tools such as add_table_join or execute_processing. It does provide useful internal selection guidance ('use 0 when several can match') and explains first-match behavior, but no when-not-to-use guidance or alternative routing is given.

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

Deploy Server

Other Tools