MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_tool_call_with_exception

Method test_tool_call_with_exception

tests/apps/test_bridge.py:228–243  ·  view source on GitHub ↗

execute_tool raises an exception.

(self)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 2

handle_messageMethod · 0.80
_make_bridgeFunction · 0.70

Tested by

no test coverage detected