Resolves TOO-388 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Primarily metadata/dependency additions with no changes to core tool execution paths; risk is limited to potential packaging/import issues from the new `arcade-mcp-server` dependency. > > **Overview** > Adds `ToolMetadata` to tool decorators across the Bright Data, ClickHouse, MongoDB, Postgres, LinkedIn, Zendesk, and Math toolkits, specifying *behavior* (read-only/idempotency/destructive/open-world) and, where applicable, *service domain* classification. > > Updates each toolkit package to depend on `arcade-mcp-server` (plus local `uv` source wiring) and bumps toolkit versions accordingly; minor `__all__` ordering tweaks in Math/Zendesk are included. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 3bde3a061194e1d1b6a4e8a2ebd608b17984db4f. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
75 lines
2 KiB
Python
75 lines
2 KiB
Python
import decimal
|
|
import math
|
|
from decimal import Decimal
|
|
from typing import Annotated
|
|
|
|
from arcade_mcp_server.metadata import Behavior, ToolMetadata
|
|
from arcade_tdk import tool
|
|
|
|
decimal.getcontext().prec = 100
|
|
|
|
|
|
@tool(
|
|
metadata=ToolMetadata(
|
|
behavior=Behavior(
|
|
read_only=True,
|
|
destructive=False,
|
|
idempotent=True,
|
|
open_world=False,
|
|
),
|
|
),
|
|
)
|
|
def ceil(
|
|
a: Annotated[str, "The number to round up as a string"],
|
|
) -> Annotated[str, "The smallest integer greater than or equal to the number as a string"]:
|
|
"""
|
|
Return the ceiling of a number
|
|
"""
|
|
# Use Decimal for arbitrary precision
|
|
return str(math.ceil(Decimal(a)))
|
|
|
|
|
|
@tool(
|
|
metadata=ToolMetadata(
|
|
behavior=Behavior(
|
|
read_only=True,
|
|
destructive=False,
|
|
idempotent=True,
|
|
open_world=False,
|
|
),
|
|
),
|
|
)
|
|
def floor(
|
|
a: Annotated[str, "The number to round down as a string"],
|
|
) -> Annotated[str, "The largest integer less than or equal to the number as a string"]:
|
|
"""
|
|
Return the floor of a number
|
|
"""
|
|
# Use Decimal for arbitrary precision
|
|
return str(math.floor(Decimal(a)))
|
|
|
|
|
|
@tool(
|
|
metadata=ToolMetadata(
|
|
behavior=Behavior(
|
|
read_only=True,
|
|
destructive=False,
|
|
idempotent=True,
|
|
open_world=False,
|
|
),
|
|
),
|
|
)
|
|
def round_num(
|
|
value: Annotated[str, "The number to round as a string"],
|
|
ndigits: Annotated[str, "The number of digits after the decimal point as a string"],
|
|
) -> Annotated[str, "The number rounded to the specified number of digits as a string"]:
|
|
"""
|
|
Round a number to a specified number of positive digits
|
|
"""
|
|
ndigits_int = int(ndigits)
|
|
if ndigits_int >= 0:
|
|
# Use Decimal for arbitrary precision
|
|
return str(round(Decimal(value), int(ndigits_int)))
|
|
# cast value from str -> float -> int here because rounding with negative
|
|
# decimals is only useful for weird math
|
|
return str(round(int(float(value)), int(ndigits_int)))
|