@@ -96,8 +96,8 @@ async function handleMcpInvoke(
9696 }
9797 } else if ( invokeValue === 'call-tool' ) {
9898 if ( ! toolName ) {
99- console . error ( 'Error: --tool is required with --invoke call-tool' ) ;
100- console . error ( 'Usage: agentcore dev --invoke call-tool --tool <name> --input \'{"arg": "value"}\'' ) ;
99+ console . error ( 'Error: --tool is required with call-tool' ) ;
100+ console . error ( 'Usage: agentcore dev call-tool --tool <name> --input \'{"arg": "value"}\'' ) ;
101101 process . exit ( 1 ) ;
102102 }
103103 // Initialize session first, then call tool with the session ID
@@ -117,8 +117,8 @@ async function handleMcpInvoke(
117117 } else {
118118 console . error ( `Error: Unknown MCP invoke command "${ invokeValue } "` ) ;
119119 console . error ( 'Usage:' ) ;
120- console . error ( ' agentcore dev --invoke list-tools' ) ;
121- console . error ( ' agentcore dev --invoke call-tool --tool <name> --input \'{"arg": "value"}\'' ) ;
120+ console . error ( ' agentcore dev list-tools' ) ;
121+ console . error ( ' agentcore dev call-tool --tool <name> --input \'{"arg": "value"}\'' ) ;
122122 process . exit ( 1 ) ;
123123 }
124124 } catch ( err ) {
@@ -137,20 +137,20 @@ export const registerDev = (program: Command) => {
137137 . command ( 'dev' )
138138 . alias ( 'd' )
139139 . description ( COMMAND_DESCRIPTIONS . dev )
140+ . argument ( '[prompt]' , 'Invoke running dev server with this prompt [non-interactive]' )
140141 . option ( '-p, --port <port>' , 'Port for development server' , '8080' )
141142 . option ( '-a, --agent <name>' , 'Agent to run or invoke (required if multiple agents)' )
142- . option ( '-i, --invoke <prompt>' , 'Invoke running dev server (use --agent if multiple) [non-interactive]' )
143- . option ( '-s, --stream' , 'Stream response when using --invoke [non-interactive]' )
143+ . option ( '-s, --stream' , 'Stream response when invoking [non-interactive]' )
144144 . option ( '-l, --logs' , 'Run dev server with logs to stdout [non-interactive]' )
145- . option ( '--tool <name>' , 'MCP tool name (used with --invoke call-tool) [non-interactive]' )
146- . option ( '--input <json>' , 'MCP tool arguments as JSON (used with --invoke call- tool) [non-interactive]' )
145+ . option ( '--tool <name>' , 'MCP tool name (used with " call-tool" prompt ) [non-interactive]' )
146+ . option ( '--input <json>' , 'MCP tool arguments as JSON (used with --tool) [non-interactive]' )
147147 . option (
148148 '-H, --header <header>' ,
149149 'Custom header to forward to the agent (format: "Name: Value", repeatable) [non-interactive]' ,
150150 ( val : string , prev : string [ ] ) => [ ...prev , val ] ,
151151 [ ] as string [ ]
152152 )
153- . action ( async opts => {
153+ . action ( async ( positionalPrompt : string | undefined , opts ) => {
154154 try {
155155 const port = parseInt ( opts . port , 10 ) ;
156156
@@ -160,8 +160,9 @@ export const registerDev = (program: Command) => {
160160 headers = parseHeaderFlags ( opts . header ) ;
161161 }
162162
163- // If --invoke provided, call the dev server and exit
164- if ( opts . invoke ) {
163+ // If a prompt is provided, call the dev server and exit
164+ const invokePrompt = positionalPrompt ;
165+ if ( invokePrompt ) {
165166 const invokeProject = await loadProjectConfig ( getWorkingDirectory ( ) ) ;
166167
167168 // Determine which agent/port to invoke
@@ -190,11 +191,11 @@ export const registerDev = (program: Command) => {
190191
191192 // Protocol-aware dispatch
192193 if ( protocol === 'MCP' ) {
193- await handleMcpInvoke ( invokePort , opts . invoke , opts . tool , opts . input , headers ) ;
194+ await handleMcpInvoke ( invokePort , invokePrompt , opts . tool , opts . input , headers ) ;
194195 } else if ( protocol === 'A2A' ) {
195- await invokeA2ADevServer ( invokePort , opts . invoke , headers ) ;
196+ await invokeA2ADevServer ( invokePort , invokePrompt , headers ) ;
196197 } else {
197- await invokeDevServer ( invokePort , opts . invoke , opts . stream ?? false , headers ) ;
198+ await invokeDevServer ( invokePort , invokePrompt , opts . stream ?? false , headers ) ;
198199 }
199200 return ;
200201 }
0 commit comments