Example translate tool.
| 118 | |
| 119 | |
| 120 | class TranslateTool(Tool): |
| 121 | """Example translate tool.""" |
| 122 | |
| 123 | @property |
| 124 | def name(self) -> str: |
| 125 | return "translate" |
| 126 | |
| 127 | @property |
| 128 | def description(self) -> str: |
| 129 | return "Translate text from one language to another" |
| 130 | |
| 131 | @property |
| 132 | def parameters(self) -> dict[str, Any]: |
| 133 | return { |
| 134 | "type": "object", |
| 135 | "properties": { |
| 136 | "text": { |
| 137 | "type": "string", |
| 138 | "description": "Text to translate", |
| 139 | }, |
| 140 | "target_language": { |
| 141 | "type": "string", |
| 142 | "description": "Target language code (e.g. 'en', 'es', 'fr')", |
| 143 | }, |
| 144 | }, |
| 145 | "required": ["text", "target_language"], |
| 146 | } |
| 147 | |
| 148 | async def execute(self, **kwargs) -> ToolResult: |
| 149 | """Mock execute method.""" |
| 150 | return ToolResult(success=True, content="Translation result") |
| 151 | |
| 152 | |
| 153 | async def demo_tool_schemas(): |
no outgoing calls
no test coverage detected