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

Method test_agent_spawn

tests/agents/test_tools.py:141–157  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

139
140 @pytest.mark.asyncio
141 async def test_agent_spawn(self):
142 mgr = MagicMock()
143 mgr.spawn_agent = AsyncMock(return_value="agent-research")
144 result = await handle_agent_tool(
145 "agent_spawn",
146 {"name": "Research", "initial_prompt": "Find docs"},
147 mgr,
148 caller_agent_id="main",
149 )
150 data = json.loads(result)
151 assert data["success"] is True
152 assert data["agent_id"] == "agent-research"
153 # Verify spawn was called with an AgentConfig
154 mgr.spawn_agent.assert_awaited_once()
155 config = mgr.spawn_agent.call_args[0][0]
156 assert config.name == "Research"
157 assert config.parent_agent_id == "main"
158
159 @pytest.mark.asyncio
160 async def test_handler_catches_exceptions(self):

Callers

nothing calls this directly

Calls 1

handle_agent_toolFunction · 0.90

Tested by

no test coverage detected