Example weather tool.
| 22 | |
| 23 | |
| 24 | class WeatherTool(Tool): |
| 25 | """Example weather tool.""" |
| 26 | |
| 27 | @property |
| 28 | def name(self) -> str: |
| 29 | return "get_weather" |
| 30 | |
| 31 | @property |
| 32 | def description(self) -> str: |
| 33 | return "Get current weather information for a location. Returns temperature and conditions." |
| 34 | |
| 35 | @property |
| 36 | def parameters(self) -> dict[str, Any]: |
| 37 | return { |
| 38 | "type": "object", |
| 39 | "properties": { |
| 40 | "location": { |
| 41 | "type": "string", |
| 42 | "description": "City and state, e.g. 'San Francisco, CA' or 'London, UK'", |
| 43 | }, |
| 44 | "unit": { |
| 45 | "type": "string", |
| 46 | "enum": ["celsius", "fahrenheit"], |
| 47 | "description": "Temperature unit (celsius or fahrenheit)", |
| 48 | }, |
| 49 | }, |
| 50 | "required": ["location"], |
| 51 | } |
| 52 | |
| 53 | async def execute(self, **kwargs) -> ToolResult: |
| 54 | """Mock execute method.""" |
| 55 | return ToolResult(success=True, content="Weather data") |
| 56 | |
| 57 | |
| 58 | class SearchTool(Tool): |
no outgoing calls
no test coverage detected