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

Class FakeToolManager

tests/planning/test_executor.py:48–68  ·  view source on GitHub ↗

Minimal ToolManager stub.

Source from the content-addressed store, hash-verified

46
47
48class FakeToolManager:
49 """Minimal ToolManager stub."""
50
51 def __init__(self, results: dict[str, Any] | None = None, *, delay: float = 0):
52 self._results = results or {}
53 self._delay = delay
54 self.calls: list[tuple[str, dict]] = []
55
56 def get_all_tools(self):
57 return [FakeToolInfo(n) for n in self._results.keys()] if self._results else []
58
59 async def execute_tool(self, tool_name, arguments, namespace=None, timeout=None):
60 if self._delay > 0:
61 await asyncio.sleep(self._delay)
62 self.calls.append((tool_name, arguments))
63 result = self._results.get(tool_name, "default result")
64 if isinstance(result, Exception):
65 return FakeToolCallResult(
66 tool_name=tool_name, success=False, error=str(result)
67 )
68 return FakeToolCallResult(tool_name=tool_name, result=result)
69
70
71class FailingToolManager(FakeToolManager):

Calls

no outgoing calls