execute_tool raises an exception.
(self)
| 226 | |
| 227 | @pytest.mark.asyncio |
| 228 | async def test_tool_call_with_exception(self): |
| 229 | """execute_tool raises an exception.""" |
| 230 | bridge, tm = _make_bridge() |
| 231 | tm._raise_on_execute = RuntimeError("server crashed") |
| 232 | msg = json.dumps( |
| 233 | { |
| 234 | "jsonrpc": "2.0", |
| 235 | "id": 10, |
| 236 | "method": "tools/call", |
| 237 | "params": {"name": "crash-tool", "arguments": {}}, |
| 238 | } |
| 239 | ) |
| 240 | resp = await bridge.handle_message(msg) |
| 241 | parsed = json.loads(resp) |
| 242 | assert parsed["error"]["code"] == -32000 |
| 243 | assert "server crashed" in parsed["error"]["message"] |
| 244 | |
| 245 | @pytest.mark.asyncio |
| 246 | async def test_invalid_tool_name_rejected(self): |
nothing calls this directly
no test coverage detected