Files
reverse-engineering-anything/scripts/verify/tool-registration-guard.mjs
T
morluto 5d3e1dc9cd refactor(mcp): bind analysis settings and session-derived comparison tools through the shared binding table (#11511)
* refactor(mcp): bind analysis settings tools through the shared binding table and count bespoke registrations

* refactor(mcp): bind inspect_analysis_view through the shared binding table (#11514)

* refactor(javascript): bind JavaScript source analysis in composition (#11467)

* refactor(mcp): bind inspect_analysis_view through the shared binding table

* ci(guards): count typed tool registrations and name each registration owner with its reason

* refactor(mcp): bind session-derived comparison tools through a derived binding kind on the shared table (#11547)
2026-11-16 06:18:49 +08:00

32 lines
1.1 KiB
JavaScript

// Each catalog tool is bound once, in the shared binding table
// (serviceToolBindings.ts / contractToolBindings.ts), so its admission,
// logging, progress and delivery come from one loop. A bespoke
// `server.registerTool` call, typed or not, re-implements that wiring for one
// family.
const toolRegistration = /\.registerTool\b(?:\s*<[^;{}()]*>)?\s*\(/gu;
/**
* Files that own registration rather than bypass it. Each entry gives the
* reason.
* @type {ReadonlyMap<string, string>}
*/
export const TOOL_REGISTRATION_OWNERS = new Map([
["src/server/contractToolBindings.ts", "The shared binding loop."],
[
"src/server/EvidenceMcpServerCore.ts",
"Wraps the SDK registration every bound tool goes through.",
],
[
"src/server/RequestTrackingMcpServer.ts",
"Forwards SDK registration to track in-flight requests.",
],
[
"src/server/environment/serveEnvironment.ts",
"The agent environment server serves its own catalog, not REA's.",
],
]);
/** @param {string} content */
export const toolRegistrationCount = (content) =>
content.match(toolRegistration)?.length ?? 0;