from ai_query import generate_text
from ai_query.providers import openai, mcp, merge_tools, tool, Field
@tool(description="Add two numbers")
def add(a: int = Field(description="First number"),
b: int = Field(description="Second number")) -> int:
return a + b
async def main():
async with mcp("python", "weather_server.py") as weather:
tools = merge_tools({"add": add}, weather)
result = await generate_text(
model=openai("gpt-4o"),
prompt="What's 5 + 3? Also, what's the weather in Paris?",
tools=tools,
)
print(result.text)