From 1aaa21296fbcf4e040880fe312375d47a85aa66e Mon Sep 17 00:00:00 2001 From: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com> Date: Fri, 16 Oct 2026 17:45:41 +0000 Subject: [PATCH] fix(experiment): exhaust native baseline catalog pages Derive missing-tool coverage only after all catalog pages are examined, reject cursor loops and omit unused result schemas in name-only generation while honoring explicit caller settings. The final actual MCP generator preserves the measured 16-tool selection and verifies owned cleanup under the resource bounds. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com> --- .../analysis-efficiency/select-kuna-tools.mjs | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/experiments/analysis-efficiency/select-kuna-tools.mjs b/experiments/analysis-efficiency/select-kuna-tools.mjs index 5a644154f7..fe470c53f5 100644 --- a/experiments/analysis-efficiency/select-kuna-tools.mjs +++ b/experiments/analysis-efficiency/select-kuna-tools.mjs @@ -29,16 +29,32 @@ const client = new Client({ const transport = new StdioClientTransport({ command: process.execPath, args: [resolve("scripts/rea.mjs"), "mcp"], - env: { ...process.env }, + env: { + ...process.env, + // This pass needs tool identities, not large result schemas. Keep any + // explicit caller profile; the measured runner already selects off. + REA_MCP_OUTPUT_SCHEMA_PROFILE: + process.env.REA_MCP_OUTPUT_SCHEMA_PROFILE ?? "off", + }, stderr: "pipe", }); let names; try { await client.connect(transport); - const { tools } = await client.listTools(); - names = tools - .filter((tool) => desired.has(tool.name)) - .map((tool) => tool.name); + names = []; + const cursors = new Set(); + let cursor; + do { + assert.ok(!cursors.has(cursor), "Catalog pagination did not advance"); + cursors.add(cursor); + const page = await client.listTools(cursor === undefined ? {} : { cursor }); + names.push( + ...page.tools + .filter((tool) => desired.has(tool.name)) + .map((tool) => tool.name), + ); + cursor = page.nextCursor; + } while (cursor !== undefined); assert.equal( new Set(names).size, names.length,