@@ -11,7 +11,7 @@ import {Client} from '@modelcontextprotocol/sdk/client/index.js';
1111import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js' ;
1212
1313import { parseArguments } from '../build/src/bin/chrome-devtools-mcp-cli-options.js' ;
14- import { labels } from '../build/src/tools/categories.js' ;
14+ import { labels , ToolCategory } from '../build/src/tools/categories.js' ;
1515import { createTools } from '../build/src/tools/tools.js' ;
1616
1717const OUTPUT_PATH = path . join (
@@ -29,7 +29,7 @@ async function fetchTools() {
2929
3030 const transport = new StdioClientTransport ( {
3131 command : 'node' ,
32- args : [ serverPath ] ,
32+ args : [ serverPath , '--viaCli' ] ,
3333 env : { ...process . env , CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS : 'true' } ,
3434 } ) ;
3535
@@ -83,7 +83,10 @@ function schemaToCLIOptions(schema: JsonSchema): CliOption[] {
8383 const properties = schema . properties ;
8484 return Object . entries ( properties ) . map ( ( [ name , prop ] ) => {
8585 const isRequired = required . includes ( name ) ;
86- const description = prop . description || '' ;
86+ let description = prop . description || '' ;
87+ if ( isRequired ) {
88+ description += ' (required)' ;
89+ }
8790 if ( typeof prop . type !== 'string' ) {
8891 throw new Error (
8992 `Property ${ name } has a complex type not supported by CLI.` ,
@@ -103,6 +106,15 @@ function schemaToCLIOptions(schema: JsonSchema): CliOption[] {
103106async function generateCli ( ) {
104107 const tools = await fetchTools ( ) ;
105108
109+ const staticTools = createTools ( parseArguments ( ) ) ;
110+ const toolNameToCategory = new Map < string , string > ( ) ;
111+ for ( const tool of staticTools ) {
112+ toolNameToCategory . set (
113+ tool . name ,
114+ labels [ tool . annotations . category as keyof typeof labels ] ,
115+ ) ;
116+ }
117+
106118 // Sort tools by name
107119 const sortedTools = tools
108120 . sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
@@ -117,18 +129,17 @@ async function generateCli() {
117129 if ( tool . name === 'wait_for' ) {
118130 return false ;
119131 }
132+ // Skipping get_tab_id as it is for internal integrations
133+ if ( tool . name === 'get_tab_id' ) {
134+ return false ;
135+ }
136+ // Skipping in_page tools as they are not launched yet
137+ if ( toolNameToCategory . get ( tool . name ) === labels [ ToolCategory . IN_PAGE ] ) {
138+ return false ;
139+ }
120140 return true ;
121141 } ) ;
122142
123- const staticTools = createTools ( parseArguments ( ) ) ;
124- const toolNameToCategory = new Map < string , string > ( ) ;
125- for ( const tool of staticTools ) {
126- toolNameToCategory . set (
127- tool . name ,
128- labels [ tool . annotations . category as keyof typeof labels ] ,
129- ) ;
130- }
131-
132143 const commands : Record <
133144 string ,
134145 { description : string ; category : string ; args : Record < string , CliOption > }
0 commit comments