Files
AI-Trader/agent_tools/tool_math.py
2025-10-24 00:35:21 +08:00

21 lines
514 B
Python

from fastmcp import FastMCP
import os
from dotenv import load_dotenv
load_dotenv()
mcp = FastMCP("Math")
@mcp.tool()
def add(a: float, b: float) -> float:
"""Add two numbers (supports int and float)"""
return float(a) + float(b)
@mcp.tool()
def multiply(a: float, b: float) -> float:
"""Multiply two numbers (supports int and float)"""
return float(a) * float(b)
if __name__ == "__main__":
port = int(os.getenv("MATH_HTTP_PORT", "8000"))
mcp.run(transport="streamable-http", port=port)