Skip to main content
Glama

Turf-MCP

by es3154

coordinate_mutation_round_number

Round numbers to specified decimal places for precise numerical control. Use this tool to format floating-point values with custom precision, ensuring consistent decimal accuracy in calculations.

Instructions

对数字进行四舍五入,控制小数位数。

此功能将数字四舍五入到指定的小数位数,用于精确控制数值的精度。

Args: num: 要四舍五入的数字 - 类型: float - 范围: 任意浮点数 - 示例: 120.4321

precision: 小数位数精度 - 类型: int - 描述: 要保留的小数位数 - 默认: 0 - 范围: 0 或正整数 - 示例: 2

Returns: str: JSON 字符串格式的四舍五入结果对象 - 类型: 包含 value 的对象 - 格式: {"value": 四舍五入后的数值} - 示例: '{"value": 120.43}'

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

Example: >>> import asyncio >>> result = asyncio.run(round_number(120.4321, 2)) >>> print(result) '{"value": 120.43}'

Notes: - 如果未提供精度参数,默认四舍五入到整数 - 精度为 0 时返回整数 - 依赖于 Turf.js 库和 Node.js 环境

Input Schema

NameRequiredDescriptionDefault
numYes
precisionNo

Input Schema (JSON Schema)

{ "properties": { "num": { "type": "number" }, "precision": { "default": 0, "type": "integer" } }, "required": [ "num" ], "type": "object" }

Other Tools from Turf-MCP

Related Tools

    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