Skip to main content
Glama
es3154

Turf-MCP

by es3154

misc_mask

Crop geospatial polygons using a mask polygon to extract the overlapping area. This tool processes GeoJSON input in WGS84 coordinates and returns the clipped polygon geometry within the mask boundary.

Instructions

使用掩膜多边形裁剪几何图形。

此功能使用掩膜多边形对输入多边形进行裁剪,返回掩膜范围内的多边形部分。

Args: polygons: 输入多边形 GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 支持 Polygon、MultiPolygon、Feature、Feature、FeatureCollection<Polygon | MultiPolygon> - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[112, -21], [116, -36], [146, -39], [153, -24], [133, -10], [112, -21]]]}'

mask_polygon: 掩膜多边形 GeoJSON 对象
    - 类型: str (JSON 字符串格式的 GeoJSON) 或 None
    - 格式: 支持 Polygon、Feature<Polygon>
    - 坐标系: WGS84 (经度在前,纬度在后)
    - 示例: '{"type": "Polygon", "coordinates": [[[90, -55], [170, -55], [170, 10], [90, 10], [90, -55]]]}'

options: 可选参数配置
    - 类型: str (JSON 字符串) 或 None
    - 可选字段:
        - mutate: 是否修改原始掩膜多边形 (默认: false)
    - 示例: '{"mutate": false}'

Returns: str: JSON 字符串格式的 GeoJSON Polygon 特征 - 类型: GeoJSON Feature with Polygon geometry - 格式: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}}

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

Example: >>> import asyncio >>> polygons = '{"type": "Polygon", "coordinates": [[[112, -21], [116, -36], [146, -39], [153, -24], [133, -10], [112, -21]]]}' >>> mask_polygon = '{"type": "Polygon", "coordinates": [[[90, -55], [170, -55], [170, 10], [90, 10], [90, -55]]]}' >>> result = asyncio.run(mask(polygons, mask_polygon)) >>> print(result) '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [...]}}'

Notes: - 输入参数 polygons 和 mask_polygon 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果未提供掩膜多边形,则使用世界范围作为掩膜 - 依赖于 Turf.js 库和 Node.js 环境

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
polygonsYes
mask_polygonNo
optionsNo

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 full burden and does well by disclosing: the tool modifies geometry through clipping, requires specific coordinate order (longitude first), has a default mask behavior, depends on Turf.js/Node.js, and raises exceptions for failures. It doesn't mention rate limits or authentication needs, but covers key behavioral aspects for a geometry processing tool.

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

Conciseness3/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) but is quite lengthy. While all content is valuable given the complex parameters, some sections like the detailed example could be more concise. The purpose statement is front-loaded effectively.

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 complex geometry processing tool with 3 parameters, 0% schema coverage, and no annotations, the description provides exceptional completeness: detailed parameter semantics, return format specification, error conditions, examples, and implementation dependencies. The output schema exists but the description still usefully explains the return format.

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?

With 0% schema description coverage, the description fully compensates by providing comprehensive parameter documentation: detailed format requirements (GeoJSON types, coordinate systems, examples), optional parameters with defaults, and clear data type specifications. It adds substantial value beyond the minimal schema that only indicates string/null types.

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 specific action ('使用掩膜多边形裁剪几何图形' - use mask polygon to clip geometric shapes) and resource (polygons). It distinguishes itself from siblings like 'transformation_bboxClip' or 'transformation_intersect' by specifying the mask-based clipping approach rather than bounding box or intersection operations.

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?

The description provides clear context about when to use this tool (for clipping polygons with a mask polygon) and includes helpful notes about default behavior (using world extent if no mask provided). However, it doesn't explicitly contrast with alternative clipping tools like 'transformation_bboxClip' or 'transformation_intersect' that might serve similar purposes.

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