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

Function schemaToCLIOptions

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

Source from the content-addressed store, hash-verified

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

Callers 1

generateCliFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected