mirror of
https://github.com/Sun-ZhenXing/mcp-template-python.git
synced 2026-03-24 03:38:05 +00:00
feat: add /ws
This commit is contained in:
@@ -1,39 +1,31 @@
|
||||
from operator import add, mul, sub, truediv
|
||||
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
from mcp_template_python.lib.better_mcp import BetterFastMCP
|
||||
|
||||
from ..config import settings
|
||||
|
||||
mcp = FastMCP("math", settings=settings.instructions)
|
||||
mcp = BetterFastMCP("math", settings=settings.instructions)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
async def add_nums(a: float, b: float) -> float:
|
||||
"""
|
||||
Adds two numbers.
|
||||
"""
|
||||
async def add_num(a: float, b: float) -> float:
|
||||
"""Adds two numbers."""
|
||||
return add(a, b)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
async def sub_nums(a: float, b: float) -> float:
|
||||
"""
|
||||
Subtracts the second number from the first.
|
||||
"""
|
||||
async def sub_num(a: float, b: float) -> float:
|
||||
"""Subtracts the second number from the first."""
|
||||
return sub(a, b)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
async def mul_nums(a: float, b: float) -> float:
|
||||
"""
|
||||
Multiplies two numbers.
|
||||
"""
|
||||
async def mul_num(a: float, b: float) -> float:
|
||||
"""Multiplies two numbers."""
|
||||
return mul(a, b)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
async def div_nums(a: float, b: float) -> float:
|
||||
"""
|
||||
Divides the first number by the second.
|
||||
"""
|
||||
async def div_num(a: float, b: float) -> float:
|
||||
"""Divides the first number by the second."""
|
||||
return truediv(a, b)
|
||||
|
||||
Reference in New Issue
Block a user