Skip to main content
Glama
es3154

Turf-MCP

by es3154

transformation_intersect

Calculate the geometric intersection of two polygons using GeoJSON data to identify overlapping areas for spatial analysis.

Instructions

计算多边形的交集。

该函数使用 Turf.js 库的 intersect 方法,计算两个多边形的几何交集。

Args: featureCollection: 包含两个多边形的 GeoJSON FeatureCollection - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON FeatureCollection 规范,包含两个 Polygon 特征 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.801742, 45.48565], [-122.801742, 45.60491], [-122.584762, 45.60491], [-122.584762, 45.48565], [-122.801742, 45.48565]]]}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.520217, 45.535693], [-122.64038, 45.553967], [-122.720031, 45.526554], [-122.669906, 45.507309], [-122.723464, 45.446643], [-122.532577, 45.408574], [-122.487258, 45.477466], [-122.520217, 45.535693]]]}}]}'

Returns: str: JSON 字符串格式的交集 GeoJSON Feature - 类型: GeoJSON Feature with Polygon or MultiPolygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}} 或 null(如果没有交集) - 示例: '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.6, 45.5], [-122.5, 45.5], ...]]}}'

Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常

Example: >>> import asyncio >>> featureCollection = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.801742, 45.48565], [-122.801742, 45.60491], [-122.584762, 45.60491], [-122.584762, 45.48565], [-122.801742, 45.48565]]]}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.520217, 45.535693], [-122.64038, 45.553967], [-122.720031, 45.526554], [-122.669906, 45.507309], [-122.723464, 45.446643], [-122.532577, 45.408574], [-122.487258, 45.477466], [-122.520217, 45.535693]]]}}]}' >>> result = asyncio.run(intersect(featureCollection)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-122.6, 45.5], [-122.5, 45.5], ...]]}}'

Notes: - 输入参数 featureCollection 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果没有交集,返回 null - 交集可以是 Point、LineString、Polygon 或 Multi* 几何类型 - 依赖于 Turf.js 库和 Node.js 环境

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
featureCollectionYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it returns a GeoJSON Feature or null if no intersection, specifies coordinate order and coordinate reference system (WGS84), mentions possible output geometry types (Polygon, MultiPolygon, etc.), and notes dependencies on Turf.js and Node.js. It also outlines error conditions (JavaScript execution failure, timeout, or invalid input). The only minor gap is lack of explicit rate limits or performance characteristics.

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 description is well-structured with clear sections (Args, Returns, Raises, Example, Notes) and front-loaded purpose statement. However, it includes an extensive Python code example that may be overly detailed for an AI agent, slightly reducing conciseness. Most sentences earn their place by providing essential information.

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?

Given the tool's complexity (geometric intersection with specific data formats), no annotations, 0% schema coverage, but with an output schema present, the description is highly complete. It covers purpose, input requirements, output behavior, error conditions, dependencies, and provides examples. The output schema handles return value structure, so the description appropriately focuses on semantics and usage context.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must fully compensate. It provides comprehensive details for the single parameter 'featureCollection': type (string/JSON), format (GeoJSON FeatureCollection with two Polygon features), coordinate system (WGS84 with longitude-first), and a detailed example. This adds significant meaning beyond the bare schema, which only indicates it's a required string.

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 clearly states the tool's purpose: '计算多边形的交集' (calculates the intersection of polygons). It specifies the exact operation (intersection), the resource (polygons), and the implementation method (Turf.js intersect). This distinguishes it from sibling tools like transformation_difference or transformation_union, which perform different geometric operations.

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?

The description implies usage through the Args and Notes sections, specifying that input must be a valid GeoJSON FeatureCollection with two polygons in WGS84 coordinates. However, it does not explicitly state when to use this tool versus alternatives like transformation_difference or transformation_union, nor does it provide exclusions or prerequisites beyond data format requirements.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/es3154/turf-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server