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

Function schemaToCLIOptions

scripts/generate-cli.ts:83–106  ·  view source on GitHub ↗
(schema: JsonSchema)

Source from the content-addressed store, hash-verified

81}
82
83function schemaToCLIOptions(schema: JsonSchema): CliOption[] {
84 if (!schema || !schema.properties) {
85 return [];
86 }
87 const required = schema.required || [];
88 const properties = schema.properties;
89 return Object.entries(properties).map(([name, prop]) => {
90 const isRequired = required.includes(name);
91 const description = prop.description || '';
92 if (typeof prop.type !== 'string') {
93 throw new Error(
94 `Property ${name} has a complex type not supported by CLI.`,
95 );
96 }
97 return {
98 name,
99 type: prop.type,
100 description,
101 required: isRequired,
102 default: prop.default,
103 enum: prop.enum,
104 };
105 });
106}
107
108async function generateCli() {
109 const tools = await fetchTools();

Callers 1

generateCliFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected