func(args WeatherArgs) (*mcp.ToolResponse, error) {
return mcp.NewToolResponse(mcp.NewTextContent(
fmt.Sprintf("%v", WeatherData{
Temperature: 75.5,
Conditions: "sunny",
Location: args.Location,
}),
)), nil
})
this might not be that elegant, why should I use a fmt.Sprintf to build a response, while in python, it goes like:
@mcp.tool()
def get_weather(location: str) -> dict:
"""Gets current weather for a location."""
# This would normally call a weather API
# Simplified for demonstration
return {
"temperature": 72.5,
"conditions": "Sunny",
"location": location
}