Skip to content

Commit 054ad14

Browse files
committed
test(compat): MCP specialists may also hold the subagent tool
1 parent fa0e4b3 commit 054ad14

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎tests/compat/chat.spec.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,15 @@ test('subagent per MCP: the orchestrator delegates, the specialist only has its
206206
: `call task ${JSON.stringify({ subagent_type: 'mcp-nest-demo', description: 'demo', prompt: 'nest probe' })}`
207207
await request.post(`/api/v1/sessions/${session.id}/prompt`, { data: { directory: WORK, agent: 'orchestrator', text: call }, timeout: 150_000 })
208208

209-
// what the mock model was offered: the specialist only nest-demo's tools,
210-
// the orchestrator none of them
209+
// what the mock model was offered: the specialist only nest-demo's tools
210+
// (plus the subagent tool to hand work to the other specialists), the
211+
// orchestrator none of them
211212
const log = readFileSync(MOCK_LOG, 'utf8').trim().split('\n').map((l) => JSON.parse(l) as { userText: string; tools: string[] })
212213
const specialist = log.filter((l) => l.userText.includes('nest probe') && !l.userText.startsWith('call') && l.tools.length).at(-1)
213214
expect(specialist?.tools.length).toBeGreaterThan(0)
214-
expect(specialist?.tools.every((t) => t.startsWith('nest-demo_'))).toBe(true)
215+
const delegation = ['task', 'subagent']
216+
expect(specialist?.tools.some((t) => t.startsWith('nest-demo_'))).toBe(true)
217+
expect(specialist?.tools.every((t) => t.startsWith('nest-demo_') || delegation.includes(t))).toBe(true)
215218
const orchestrator = log.filter((l) => l.userText.startsWith('call') && l.userText.includes('nest probe') && l.tools.length).at(-1)
216219
expect(orchestrator?.tools.some((t) => t.startsWith('nest-demo_'))).toBe(false)
217220
} finally {

0 commit comments

Comments
 (0)