<!-- CURSOR_SUMMARY --> > [!NOTE] > **Medium Risk** > Touches multiple toolkits’ runtime entrypoints and context/error/auth plumbing, so breakage risk is mainly around invocation/packaging and tool execution wiring rather than business logic. > > **Overview** > Migrates the BrightData, ClickHouse, LinkedIn, Math, MongoDB, Postgres, and Zendesk OSS toolkits from `arcade-tdk` to `arcade-mcp-server` APIs by updating tool decorators, `Context` types, auth classes, and exception imports. > > Adds per-toolkit `__main__.py` files that construct an `MCPApp`, register module tools, and run via configurable transport/host/port; corresponding `pyproject.toml` updates bump versions, drop `arcade-tdk`/`arcade-serve` deps, and add `project.scripts` console entrypoints. > > Updates tests and eval suites to use `arcade_mcp_server.Context` (mocked) and switches eval `ToolCatalog` imports to `arcade_core`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 9b3e31acb4b35e1d72efd47e2d279c5b19e3ecb0. 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 import tool
|
|
from arcade_mcp_server.metadata import Behavior, ToolMetadata
|
|
|
|
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)))
|