arcade-mcp/libs/arcade-mcp-server/docs/examples/tools_math.py
Eric Gustin a11f79b32d
Update arcade-mcp-server docs (#597)
1. Updates docs to prefer `uv run server.py` instead of `arcade mcp` or
`python -m arcade_mcp_server`
2. Found a bug with running stdio servers while updating the docs, so i
snuck that in this PR
2025-10-02 17:16:38 -07:00

31 lines
786 B
Python

#!/usr/bin/env python3
"""
tools_math.py - Mathematical tools
This file demonstrates how to organize tools in separate files.
All functions decorated with @tool will be discoverable and can be imported.
"""
from typing import Annotated
from arcade_mcp_server import tool
@tool
def add(a: Annotated[int, "First number"], b: Annotated[int, "Second number"]) -> int:
"""Add two numbers together."""
return a + b
@tool
def multiply(a: Annotated[int, "First number"], b: Annotated[int, "Second number"]) -> int:
"""Multiply two numbers together."""
return a * b
@tool
def divide(a: Annotated[float, "Dividend"], b: Annotated[float, "Divisor"]) -> float:
"""Divide two numbers."""
if b == 0:
raise ValueError("Cannot divide by zero")
return a / b