MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / schemaToCLIOptions

Function schemaToCLIOptions

scripts/generate-cli.ts:55–80  ·  view source on GitHub ↗
(toolName: string, schema: JsonSchema)

Source from the content-addressed store, hash-verified

53}
54
55function schemaToCLIOptions(toolName: string, schema: JsonSchema): CliOption[] {
56 if (!schema || !schema.properties) {
57 return [];
58 }
59 const required = schema.required || [];
60 const properties = schema.properties;
61 return Object.entries(properties).map(([name, prop]) => {
62 const isRequired = required.includes(name);
63 const description = prop.description || '';
64 if (typeof prop.type !== 'string') {
65 throw new Error(
66 `Property ${name} has a complex type not supported by CLI.`,
67 );
68 }
69 return {
70 name,
71 type: prop.type,
72 description,
73 required: isRequired,
74 positional:
75 isRequired || OPTIONAL_POSITIONAL_ARGS.has(`${toolName}:${name}`),
76 default: prop.default,
77 enum: prop.enum,
78 };
79 });
80}
81
82async function generateCli() {
83 const tools = createTools(

Callers 1

generateCliFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected