Skip to main content
Glama
es3154

Turf-MCP

by es3154

misc_line_slice

Extract a segment from a line between two specified points using GeoJSON data. This tool finds the nearest positions on a line to given start and end points, then returns the sliced portion as a GeoJSON LineString.

Instructions

在线段上截取指定起点和终点之间的部分。

此功能在线段上找到与起点和终点最近的位置,并截取这两点之间的线段部分。

Args: start_point: 起点 GeoJSON Point 特征或几何图形 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 必须符合 GeoJSON Point 规范 - 坐标系: WGS84 (经度在前,纬度在后) - 示例: '{"type": "Point", "coordinates": [-77.029609, 38.881946]}'

end_point: 终点 GeoJSON Point 特征或几何图形
    - 类型: str (JSON 字符串格式的 GeoJSON)
    - 格式: 必须符合 GeoJSON Point 规范
    - 坐标系: WGS84 (经度在前,纬度在后)
    - 示例: '{"type": "Point", "coordinates": [-77.021884, 38.889563]}'

line: 线 GeoJSON 特征或几何图形
    - 类型: str (JSON 字符串格式的 GeoJSON)
    - 格式: 必须符合 GeoJSON LineString 规范
    - 坐标系: WGS84 (经度在前,纬度在后)
    - 示例: '{"type": "LineString", "coordinates": [[-77.031669, 38.878605], [-77.029609, 38.881946], [-77.020339, 38.884084], [-77.025661, 38.885821], [-77.021884, 38.889563], [-77.019824, 38.892368]]}'

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

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

Example: >>> import asyncio >>> start = '{"type": "Point", "coordinates": [-77.029609, 38.881946]}' >>> end = '{"type": "Point", "coordinates": [-77.021884, 38.889563]}' >>> line = '{"type": "LineString", "coordinates": [[-77.031669, 38.878605], [-77.029609, 38.881946], [-77.020339, 38.884084], [-77.025661, 38.885821], [-77.021884, 38.889563], [-77.019824, 38.892368]]}' >>> result = asyncio.run(line_slice(start, end, line)) >>> print(result) '{"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-77.029609, 38.881946], [-77.021884, 38.889563]]}}'

Notes: - 输入参数 start_point、end_point 和 line 必须是有效的 JSON 字符串 - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 截取起点和终点之间的线段部分 - 依赖于 Turf.js 库和 Node.js 环境

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_pointYes
end_pointYes
lineYes

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 finds nearest points on the line to the given start/end points, returns a GeoJSON LineString feature, raises exceptions for failures or bad input, and depends on Turf.js and Node.js. It covers mutation behavior (slicing), output format, error conditions, and dependencies, though it could mention performance or rate limits.

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 appropriately sized but not optimally structured. It starts with a clear purpose, but includes extensive parameter details (Args, Returns, Raises, Example, Notes) that, while valuable, could be more front-loaded. Every sentence earns its place, but the organization could be improved for quick scanning, with key usage info earlier.

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 slicing), no annotations, 0% schema coverage, and an output schema present, the description is complete. It explains the operation, parameters, return values, errors, examples, and dependencies. The output schema handles return structure, so the description need not duplicate that, making it well-rounded for agent understanding.

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 provides detailed semantics for all three parameters: types (JSON strings), formats (GeoJSON Point/LineString), coordinate system (WGS84 with longitude first), and examples. This adds significant meaning beyond the basic schema, fully documenting parameter requirements and 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: '在线段上截取指定起点和终点之间的部分' (extract the segment between specified start and end points on a line). It uses specific verbs ('截取' - slice/extract) and resources ('线段' - line segment), and distinguishes from sibling tools like 'misc_line_slice_along' (which slices by distance) and 'misc_line_segment' (which might create segments differently).

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 implies usage context through the example and notes (e.g., requires valid GeoJSON strings, WGS84 coordinates). However, it does not explicitly state when to use this tool versus alternatives like 'misc_line_slice_along' or 'misc_line_segment', nor does it mention prerequisites or exclusions beyond format requirements. The guidance is clear but lacks explicit comparison with 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