@@ -4,6 +4,7 @@ import { jsonObjectSchema } from '../../../types/json'
44import {
55 $getNativeToolCallExampleString ,
66 coerceToArray ,
7+ coerceToObject ,
78 jsonToolResultSchema ,
89} from '../utils'
910
@@ -18,84 +19,80 @@ export const spawnAgentsOutputSchema = z
1819
1920const toolName = 'spawn_agents'
2021const endsAgentStep = true
21- const inputSchema = z
22- . object ( {
23- agents : z . preprocess (
24- coerceToArray ,
22+ const agentInputSchema = z . object ( {
23+ agent_type : z . string ( ) . describe ( 'Agent to spawn' ) ,
24+ prompt : z . string ( ) . optional ( ) . describe ( 'Prompt to send to the agent' ) ,
25+ params : z
26+ . preprocess (
27+ coerceToObject ,
2528 z
2629 . object ( {
27- agent_type : z . string ( ) . describe ( 'Agent to spawn' ) ,
28- prompt : z . string ( ) . optional ( ) . describe ( 'Prompt to send to the agent' ) ,
29- params : z
30- . object ( {
31- // Common agent fields (all optional hints — each agent validates its own required fields)
32- command : z
33- . string ( )
34- . optional ( )
35- . describe ( 'Terminal command to run (basher, tmux-cli)' ) ,
36- what_to_summarize : z
37- . string ( )
38- . optional ( )
39- . describe (
40- 'What information from the command output is desired (basher)' ,
41- ) ,
42- timeout_seconds : z
43- . number ( )
44- . optional ( )
45- . describe (
46- 'Timeout for command. Set to -1 for no timeout. Default 30 (basher)' ,
47- ) ,
48- searchQueries : z
49- . array (
50- z . object ( {
51- pattern : z . string ( ) . describe ( 'The pattern to search for' ) ,
52- flags : z
53- . string ( )
54- . optional ( )
55- . describe (
56- 'Optional ripgrep flags (e.g., "-i", "-g *.ts")' ,
57- ) ,
58- cwd : z
59- . string ( )
60- . optional ( )
61- . describe (
62- 'Optional working directory relative to project root' ,
63- ) ,
64- maxResults : z
65- . number ( )
66- . optional ( )
67- . describe ( 'Max results per file. Default 15' ) ,
68- } ) ,
69- )
70- . optional ( )
71- . describe ( 'Array of code search queries (code-searcher)' ) ,
72- filePaths : z
73- . array ( z . string ( ) )
74- . optional ( )
75- . describe (
76- 'Relevant file paths to read (opus-agent, gpt-5-agent)' ,
77- ) ,
78- directories : z
79- . array ( z . string ( ) )
80- . optional ( )
81- . describe ( 'Directories to search within (file-picker)' ) ,
82- url : z
83- . string ( )
84- . optional ( )
85- . describe ( 'Starting URL to navigate to (browser-use)' ) ,
86- prompts : z
87- . array ( z . string ( ) )
88- . optional ( )
89- . describe (
90- 'Array of strategy prompts (editor-multi-prompt, code-reviewer-multi-prompt)' ,
91- ) ,
92- } )
93- . catchall ( z . any ( ) )
30+ // Common agent fields (all optional hints — each agent validates its own required fields)
31+ command : z
32+ . string ( )
33+ . optional ( )
34+ . describe ( 'Terminal command to run (basher, tmux-cli)' ) ,
35+ what_to_summarize : z
36+ . string ( )
37+ . optional ( )
38+ . describe (
39+ 'What information from the command output is desired (basher)' ,
40+ ) ,
41+ timeout_seconds : z
42+ . number ( )
43+ . optional ( )
44+ . describe (
45+ 'Timeout for command. Set to -1 for no timeout. Default 30 (basher)' ,
46+ ) ,
47+ searchQueries : z
48+ . array (
49+ z . object ( {
50+ pattern : z . string ( ) . describe ( 'The pattern to search for' ) ,
51+ flags : z
52+ . string ( )
53+ . optional ( )
54+ . describe ( 'Optional ripgrep flags (e.g., "-i", "-g *.ts")' ) ,
55+ cwd : z
56+ . string ( )
57+ . optional ( )
58+ . describe ( 'Optional working directory relative to project root' ) ,
59+ maxResults : z
60+ . number ( )
61+ . optional ( )
62+ . describe ( 'Max results per file. Default 15' ) ,
63+ } ) ,
64+ )
65+ . optional ( )
66+ . describe ( 'Array of code search queries (code-searcher)' ) ,
67+ filePaths : z
68+ . array ( z . string ( ) )
9469 . optional ( )
95- . describe ( 'Parameters object for the agent' ) ,
70+ . describe ( 'Relevant file paths to read (opus-agent, gpt-5-agent)' ) ,
71+ directories : z
72+ . array ( z . string ( ) )
73+ . optional ( )
74+ . describe ( 'Directories to search within (file-picker)' ) ,
75+ url : z
76+ . string ( )
77+ . optional ( )
78+ . describe ( 'Starting URL to navigate to (browser-use)' ) ,
79+ prompts : z
80+ . array ( z . string ( ) )
81+ . optional ( )
82+ . describe (
83+ 'Array of strategy prompts (editor-multi-prompt, code-reviewer-multi-prompt)' ,
84+ ) ,
9685 } )
97- . array ( ) ,
98- ) ,
86+ . catchall ( z . any ( ) )
87+ . optional ( )
88+ . describe ( 'Parameters object for the agent' ) ,
89+ )
90+ . optional ( )
91+ . describe ( 'Parameters object for the agent' ) ,
92+ } )
93+ const inputSchema = z
94+ . object ( {
95+ agents : z . preprocess ( coerceToArray , agentInputSchema . array ( ) ) ,
9996 } )
10097 . describe (
10198 `Spawn multiple agents and send a prompt and/or parameters to each of them. These agents will run in parallel. Note that that means they will run independently. If you need to run agents sequentially, use spawn_agents with one agent at a time instead.` ,
0 commit comments