Skip to main content
Glama
es3154

Turf-MCP

by es3154

feature_conversion_polygonize

Convert line geometries to polygons by creating closed shapes from line or multi-line GeoJSON data for spatial analysis and mapping applications.

Instructions

将线几何图形转换为多边形。

此功能将线或多线几何图形转换为多边形几何图形集合,基于线的闭合区域创建多边形。

Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON FeatureCollection, Geometry 或 Feature 规范,包含 LineString 或 MultiLineString - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]}}]}'

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

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

Example: >>> import asyncio >>> geojson = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]}}]}' >>> result = asyncio.run(polygonize(geojson)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]]}}]}'

Notes: - 输入参数 geojson 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 基于线的闭合区域创建多边形 - 依赖于 Turf.js 库和 Node.js 环境

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geojsonYes

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. It discloses key behavioral traits: the tool creates polygons from closed line regions, requires specific input formats (GeoJSON with WGS84 coordinates), and can raise exceptions for execution failures, timeouts, or data errors. It also notes dependencies on external libraries. While comprehensive, it could mention performance aspects like processing time or limitations with non-closed lines.

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 sections for purpose, args, returns, raises, example, and notes, making it easy to navigate. It is appropriately sized with no redundant information. However, the example and notes sections are slightly verbose, and the front-loading could be improved by placing the core purpose more prominently, but overall it is efficient.

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 conversion), no annotations, 0% schema coverage, and the presence of an output schema, the description is complete. It covers input requirements, output format, error handling, dependencies, and provides an example. The output schema details the return type, so the description doesn't need to explain return values further, making it fully adequate for the 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?

The schema description coverage is 0%, so the description must compensate fully. It provides detailed semantics for the 'geojson' parameter: type (JSON string), format (GeoJSON FeatureCollection/Geometry/Feature with LineString/MultiLineString), coordinate system (WGS84), and an example. This adds significant value beyond the basic schema, ensuring the agent understands parameter requirements and constraints.

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: '将线几何图形转换为多边形' (convert line geometries to polygons). It specifies the exact transformation (lines to polygons) and distinguishes it from sibling tools like 'feature_conversion_line_to_polygon' by providing additional context about handling closed regions and using Turf.js, making it specific and differentiated.

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 on when to use this tool: for converting LineString or MultiLineString geometries to polygons based on closed regions. It mentions dependencies (Turf.js, Node.js) and input requirements (valid JSON, WGS84). However, it does not explicitly state when not to use it or compare it to alternatives like 'feature_conversion_line_to_polygon', which is a sibling tool, leaving some ambiguity.

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