Skip to main content
Glama
es3154

Turf-MCP

by es3154

transformation_simplify

Simplify GeoJSON geometry by reducing complexity while preserving shape using Turf.js algorithms. Accepts tolerance and quality settings to control simplification level.

Instructions

简化 GeoJSON 几何。

该函数使用 Turf.js 库的 simplify 方法,简化给定的 GeoJSON 几何图形。

Args: geojson: GeoJSON 对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Polygon", "coordinates": [[[-70.603637, -33.399918], [-70.614624, -33.395332], [-70.639343, -33.392466], [-70.659942, -33.394759], [-70.683975, -33.404504], [-70.697021, -33.419406], [-70.701141, -33.434306], [-70.700454, -33.446339], [-70.694274, -33.458369], [-70.682601, -33.465816], [-70.668869, -33.472117], [-70.646209, -33.473835], [-70.624923, -33.472117], [-70.609817, -33.468107], [-70.595397, -33.458369], [-70.587158, -33.442901], [-70.587158, -33.426283], [-70.590591, -33.414248], [-70.594711, -33.406224], [-70.603637, -33.399918]]]}'

options: 可选参数配置
    - 类型: str (JSON 字符串) 或 None
    - 可选字段:
        - tolerance: 简化容差 (默认: 1)
        - highQuality: 是否使用高质量简化 (默认: false)
        - mutate: 是否允许修改输入对象 (默认: false)
    - 示例: '{"tolerance": 0.01, "highQuality": true}'

Returns: str: JSON 字符串格式的简化后的 GeoJSON 对象 - 类型: 与输入相同的 GeoJSON 类型 - 格式: 与输入相同的格式 - 示例: '{"type": "Polygon", "coordinates": [[[-70.603637, -33.399918], [-70.614624, -33.395332], [-70.639343, -33.392466], ...]]}'

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

Example: >>> import asyncio >>> geojson = '{"type": "Polygon", "coordinates": [[[-70.603637, -33.399918], [-70.614624, -33.395332], [-70.639343, -33.392466], [-70.659942, -33.394759], [-70.683975, -33.404504], [-70.697021, -33.419406], [-70.701141, -33.434306], [-70.700454, -33.446339], [-70.694274, -33.458369], [-70.682601, -33.465816], [-70.668869, -33.472117], [-70.646209, -33.473835], [-70.624923, -33.472117], [-70.609817, -33.468107], [-70.595397, -33.458369], [-70.587158, -33.442901], [-70.587158, -33.426283], [-70.590591, -33.414248], [-70.594711, -33.406224], [-70.603637, -33.399918]]]}' >>> options = '{"tolerance": 0.01, "highQuality": true}' >>> result = asyncio.run(simplify(geojson, options)) >>> print(result) '{"type": "Polygon", "coordinates": [[[-70.603637, -33.399918], [-70.614624, -33.395332], [-70.639343, -33.392466], ...]]}'

Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - tolerance 值越小,简化程度越低 - highQuality 为 true 时使用更精确但更慢的算法 - 依赖于 Turf.js 库和 Node.js 环境

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geojsonYes
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: it explains the tool modifies geometry (implied by '简化'), specifies coordinate system (WGS84), describes algorithm behavior (tolerance and highQuality effects), and notes dependencies (Turf.js, Node.js). It also mentions error conditions (JavaScript failures, timeouts, bad input). No contradictions exist as annotations are absent.

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 (Args, Returns, Raises, Example, Notes) and front-loaded purpose. However, it includes an extensive example and detailed notes that, while informative, could be slightly verbose. Most sentences earn their place by clarifying usage.

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 complexity (a transformation tool with 2 parameters), no annotations, 0% schema coverage, and an output schema present, the description is highly complete. It covers purpose, parameters, return values, errors, examples, and technical notes, providing all necessary context for an agent to use the tool correctly.

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 compensate fully. It does: it details both parameters (geojson and options) with types, formats, examples, and for options, lists optional fields with defaults and effects. This adds significant meaning beyond the basic schema, fully documenting parameter usage.

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: '简化 GeoJSON 几何' (simplify GeoJSON geometry) and specifies it uses Turf.js's simplify method. It distinguishes from siblings by focusing on simplification rather than other transformations like buffer, union, or clipping listed in the sibling tools.

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 for when to use this tool (to simplify GeoJSON geometry) and includes technical prerequisites (valid JSON strings, WGS84 coordinate order). However, it does not explicitly state when not to use it or name specific alternatives among the sibling tools for different geometric operations.

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