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

Function walk

server/tests/unit/idempotency.test.ts:50–63  ·  view source on GitHub ↗
(d: string)

Source from the content-addressed store, hash-verified

48 const schemasDir = path.resolve(__dirname, '../../../static/schemas/source');
49 const derived = new Set<string>();
50 const walk = (d: string) => {
51 for (const entry of fs.readdirSync(d, { withFileTypes: true })) {
52 const p = path.join(d, entry.name);
53 if (entry.isDirectory()) { walk(p); continue; }
54 if (!entry.name.endsWith('-request.json')) continue;
55 let schema: { required?: unknown };
56 try { schema = JSON.parse(fs.readFileSync(p, 'utf8')) as { required?: unknown }; }
57 catch { continue; }
58 const req = Array.isArray(schema.required) ? schema.required : [];
59 if (req.includes('idempotency_key')) {
60 derived.add(entry.name.replace(/-request\.json$/, '').replace(/-/g, '_'));
61 }
62 }
63 };
64 walk(schemasDir);
65
66 const actual = new Set(MUTATING_TOOLS);

Callers 1

Calls 1

addMethod · 0.80

Tested by

no test coverage detected