20 lines
563 B
Python
20 lines
563 B
Python
from .schema import AddInputModel
|
|
|
|
async def add_handler(args) -> float:
|
|
try:
|
|
# Validate input using Pydantic model
|
|
input_model = AddInputModel(**args)
|
|
except Exception as e:
|
|
raise ValueError(f"Invalid input: {str(e)}")
|
|
|
|
# TODO: add Pydantic, so we can create an AddInputModel and validate args
|
|
|
|
"""Handler function for the add tool."""
|
|
return float(input_model.a) + float(input_model.b)
|
|
|
|
add = {
|
|
"name": "add",
|
|
"description": "Adds two numbers",
|
|
"input_schema": AddInputModel,
|
|
"handler": add_handler
|
|
} |