MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / walk

Function walk

scripts/build-compliance.cjs:252–267  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

250 const refs = new Set();
251 const tools = new Set();
252 function walk(d) {
253 for (const entry of fs.readdirSync(d, { withFileTypes: true })) {
254 const p = path.join(d, entry.name);
255 if (entry.isDirectory()) { walk(p); continue; }
256 if (!entry.name.endsWith('-request.json')) continue;
257 let schema;
258 try { schema = JSON.parse(fs.readFileSync(p, 'utf8')); }
259 catch { continue; }
260 const required = Array.isArray(schema.required) ? schema.required : [];
261 if (required.includes('idempotency_key')) {
262 refs.add(path.relative(schemasDir, p));
263 // Task name ↔ filename: "create-media-buy-request.json" → "create_media_buy"
264 tools.add(entry.name.replace(/-request\.json$/, '').replace(/-/g, '_'));
265 }
266 }
267 }
268 walk(schemasDir);
269 return { refs, tools };
270}

Callers 2

loadMutatingSchemaRefsFunction · 0.70

Calls 2

addMethod · 0.80
lintFileFunction · 0.70

Tested by

no test coverage detected