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

Function schemaToCLIOptions

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

Source from the content-addressed store, hash-verified

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

Callers 1

generateCliFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected