<!-- 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 -->
161 lines
4 KiB
Python
161 lines
4 KiB
Python
import decimal
|
|
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 add(
|
|
a: Annotated[str, "The first number as a string"],
|
|
b: Annotated[str, "The second number as a string"],
|
|
) -> Annotated[str, "The sum of the two numbers as a string"]:
|
|
"""
|
|
Add two numbers together
|
|
"""
|
|
# Use Decimal for arbitrary precision
|
|
a_decimal = Decimal(a)
|
|
b_decimal = Decimal(b)
|
|
return str(a_decimal + b_decimal)
|
|
|
|
|
|
@tool(
|
|
metadata=ToolMetadata(
|
|
behavior=Behavior(
|
|
read_only=True,
|
|
destructive=False,
|
|
idempotent=True,
|
|
open_world=False,
|
|
),
|
|
),
|
|
)
|
|
def subtract(
|
|
a: Annotated[str, "The first number as a string"],
|
|
b: Annotated[str, "The second number as a string"],
|
|
) -> Annotated[str, "The difference of the two numbers as a string"]:
|
|
"""
|
|
Subtract two numbers
|
|
"""
|
|
# Use Decimal for arbitrary precision
|
|
a_decimal = Decimal(a)
|
|
b_decimal = Decimal(b)
|
|
return str(a_decimal - b_decimal)
|
|
|
|
|
|
@tool(
|
|
metadata=ToolMetadata(
|
|
behavior=Behavior(
|
|
read_only=True,
|
|
destructive=False,
|
|
idempotent=True,
|
|
open_world=False,
|
|
),
|
|
),
|
|
)
|
|
def multiply(
|
|
a: Annotated[str, "The first number as a string"],
|
|
b: Annotated[str, "The second number as a string"],
|
|
) -> Annotated[str, "The product of the two numbers as a string"]:
|
|
"""
|
|
Multiply two numbers together
|
|
"""
|
|
# Use Decimal for arbitrary precision
|
|
a_decimal = Decimal(a)
|
|
b_decimal = Decimal(b)
|
|
return str(a_decimal * b_decimal)
|
|
|
|
|
|
@tool(
|
|
metadata=ToolMetadata(
|
|
behavior=Behavior(
|
|
read_only=True,
|
|
destructive=False,
|
|
idempotent=True,
|
|
open_world=False,
|
|
),
|
|
),
|
|
)
|
|
def divide(
|
|
a: Annotated[str, "The first number as a string"],
|
|
b: Annotated[str, "The second number as a string"],
|
|
) -> Annotated[str, "The quotient of the two numbers as a string"]:
|
|
"""
|
|
Divide two numbers
|
|
"""
|
|
# Use Decimal for arbitrary precision
|
|
a_decimal = Decimal(a)
|
|
b_decimal = Decimal(b)
|
|
return str(a_decimal / b_decimal)
|
|
|
|
|
|
@tool(
|
|
metadata=ToolMetadata(
|
|
behavior=Behavior(
|
|
read_only=True,
|
|
destructive=False,
|
|
idempotent=True,
|
|
open_world=False,
|
|
),
|
|
),
|
|
)
|
|
def sum_list(
|
|
numbers: Annotated[list[str], "The list of numbers as strings"],
|
|
) -> Annotated[str, "The sum of the numbers in the list as a string"]:
|
|
"""
|
|
Sum all numbers in a list
|
|
"""
|
|
# Use Decimal for arbitrary precision
|
|
return str(sum([Decimal(n) for n in numbers]))
|
|
|
|
|
|
@tool(
|
|
metadata=ToolMetadata(
|
|
behavior=Behavior(
|
|
read_only=True,
|
|
destructive=False,
|
|
idempotent=True,
|
|
open_world=False,
|
|
),
|
|
),
|
|
)
|
|
def sum_range(
|
|
start: Annotated[str, "The start of the range to sum as a string"],
|
|
end: Annotated[str, "The end of the range to sum as a string"],
|
|
) -> Annotated[str, "The sum of the numbers in the list as a string"]:
|
|
"""
|
|
Sum all numbers from start through end
|
|
"""
|
|
return str(sum(list(range(int(start), int(end) + 1))))
|
|
|
|
|
|
@tool(
|
|
metadata=ToolMetadata(
|
|
behavior=Behavior(
|
|
read_only=True,
|
|
destructive=False,
|
|
idempotent=True,
|
|
open_world=False,
|
|
),
|
|
),
|
|
)
|
|
def mod(
|
|
a: Annotated[str, "The dividend as a string"],
|
|
b: Annotated[str, "The divisor as a string"],
|
|
) -> Annotated[str, "The remainder after dividing a by b as a string"]:
|
|
"""
|
|
Calculate the remainder (modulus) of one number divided by another
|
|
"""
|
|
# Use Decimal for arbitrary precision
|
|
return str(Decimal(a) % Decimal(b))
|