Skip to main content
Glama
es3154

Turf-MCP

by es3154

misc_line_chunk

Segment lines into specified-length segments for spatial analysis and processing. This tool divides LineString or MultiLineString geometries into uniform segments using GeoJSON input.

Instructions

将线分割为指定长度的线段。

此功能将线或多线几何图形分割为多个指定长度的线段,便于分段处理和分析。

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

segment_length: 线段长度
    - 类型: float
    - 描述: 每个线段的长度值
    - 示例: 15.0

options: 可选参数配置
    - 类型: str (JSON 字符串) 或 None
    - 可选字段:
        - units: 距离单位 (默认: 'kilometers')
            - 有效值: 'miles', 'nauticalmiles', 'kilometers', 'meters', 'yards', 'feet', 'inches'
        - reverse: 是否反转坐标顺序 (默认: false)
    - 示例: '{"units": "miles", "reverse": false}'

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

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

Example: >>> import asyncio >>> line = '{"type": "LineString", "coordinates": [[-95, 40], [-93, 45], [-85, 50]]}' >>> options = '{"units": "miles"}' >>> result = asyncio.run(line_chunk(line, 15.0, options)) >>> print(result) '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [...]}}, ...]}'

Notes: - 输入参数 geojson 和 options 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果线长度小于分段长度,则返回原始线 - 依赖于 Turf.js 库和 Node.js 环境

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geojsonYes
segment_lengthYes
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 the full burden of behavioral disclosure. It effectively describes key behaviors: it returns a GeoJSON FeatureCollection of LineString features, handles edge cases (returns original line if shorter than segment length), specifies coordinate order and coordinate reference system (WGS84), and mentions dependencies and error conditions (JavaScript execution failures, timeouts, input format errors). It does not cover rate limits or authentication needs, but provides substantial operational context.

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), front-loading the core purpose. It is appropriately sized for a tool with three parameters and complex behavior, though some sections (like the detailed example) are lengthy but necessary for clarity. Every sentence adds value without redundancy.

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 (geospatial processing with multiple parameters), no annotations, and an output schema (implied by Returns section), the description is highly complete. It covers input requirements, output format, error handling, examples, dependencies, and edge cases, providing all necessary context for an AI agent to invoke the tool correctly without relying on external documentation.

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 detailed semantics for all three parameters: geojson (type, format, coordinate system, examples), segment_length (type, description, example), and options (type, optional fields with defaults and valid values, example). This adds significant value beyond the bare schema, fully documenting parameter usage 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 with specific verbs ('分割' meaning 'split' or 'divide') and resources ('线或多线几何图形' meaning 'line or multi-line geometry'), distinguishing it from siblings like misc_line_split (which likely splits at points) or misc_line_slice (which slices between points). It explicitly mentions segmenting into specified lengths for processing and analysis.

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 by specifying it handles LineString or MultiLineString geometries, but does not explicitly state when to use this tool versus alternatives like misc_line_split or misc_line_slice. It provides context on input formats and dependencies (Turf.js, Node.js), but lacks explicit guidance on tool selection among siblings.

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