File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,3 +91,11 @@ For more verbose logs, set the `DEBUG` environment variable:
9191``` sh
9292DEBUG=* chrome-devtools list_pages
9393```
94+
95+ ## CLI generation
96+
97+ Implemented in ` scripts/generate-cli.ts ` . Some commands are excluded from CLI
98+ generation such as ` wait_for ` and ` fill_form ` .
99+
100+ ` chrome-devtools-mcp ` args are also filtered in ` src/bin/chrome-devtools.ts `
101+ because not all args make sense in a CLI interface.
Original file line number Diff line number Diff line change @@ -102,8 +102,23 @@ function schemaToCLIOptions(schema: JsonSchema): CliOption[] {
102102
103103async function generateCli ( ) {
104104 const tools = await fetchTools ( ) ;
105+
105106 // Sort tools by name
106- const sortedTools = tools . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
107+ const sortedTools = tools
108+ . sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
109+ . filter ( tool => {
110+ // Skipping fill_form because it is not relevant in shell scripts
111+ // and CLI does not handle array/JSON args well.
112+ if ( tool . name === 'fill_form' ) {
113+ return false ;
114+ }
115+ // Skipping wait_for because CLI does not handle array/JSON args well
116+ // and shell scripts have many mechanisms for waiting.
117+ if ( tool . name === 'wait_for' ) {
118+ return false ;
119+ }
120+ return true ;
121+ } ) ;
107122
108123 const staticTools = createTools ( parseArguments ( ) ) ;
109124 const toolNameToCategory = new Map < string , string > ( ) ;
Original file line number Diff line number Diff line change @@ -184,25 +184,6 @@ export const commands: Commands = {
184184 } ,
185185 } ,
186186 } ,
187- fill_form : {
188- description : 'Fill out multiple form elements at once' ,
189- category : 'Input automation' ,
190- args : {
191- elements : {
192- name : 'elements' ,
193- type : 'array' ,
194- description : 'Elements from snapshot to fill out.' ,
195- required : true ,
196- } ,
197- includeSnapshot : {
198- name : 'includeSnapshot' ,
199- type : 'boolean' ,
200- description :
201- 'Whether to include a snapshot in the response. Default is false.' ,
202- required : false ,
203- } ,
204- } ,
205- } ,
206187 get_console_message : {
207188 description :
208189 'Gets a console message by its ID. You can get all messages by calling list_console_messages.' ,
@@ -722,24 +703,4 @@ export const commands: Commands = {
722703 } ,
723704 } ,
724705 } ,
725- wait_for : {
726- description : 'Wait for the specified text to appear on the selected page.' ,
727- category : 'Navigation automation' ,
728- args : {
729- text : {
730- name : 'text' ,
731- type : 'array' ,
732- description :
733- 'Non-empty list of texts. Resolves when any value appears on the page.' ,
734- required : true ,
735- } ,
736- timeout : {
737- name : 'timeout' ,
738- type : 'integer' ,
739- description :
740- 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.' ,
741- required : false ,
742- } ,
743- } ,
744- } ,
745706} as const ;
You can’t perform that action at this time.
0 commit comments