mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 09:56:23 +00:00
* fix(mcp): paginate tools/list under the FastMCP SSE limit Unsloth's FastMCP client rejects the single tools/list event because the full 241-tool catalog serializes to about 4.2 MB, over its 1 MiB SSE cap, so every refresh fails. The MCP SDK returns the whole catalog with no nextCursor, and the server never handled the cursor at all. Page oversized listings at the transport seam, per the MCP cursor contract: pages stay under 896 KiB, cursors are bound to the catalog snapshot, and catalogs that fit are returned in one response as before. * fix(mcp): track pending tools/list requests in one map pendingToolListCursors already held every tools/list id, including requests without a cursor. Membership, cancellation, and cleanup now use that map. Cursor rejection tests assert JSON-RPC -32602, then a cursorless listing returns the complete current catalog. * fix(mcp): count one schema discovery per tools/list pagination The paged tools/list turns one logical discovery into several wire requests, which broke the artifact verifier probe's per-request counting and its duplicate injection assumed the target tool on the first page. Count one discovery per listTools call and inject the duplicate only on the page carrying the tool. * fix(mcp): bind tools/list cursors to full tool definitions A cursor digest now covers each advertised tool, so a schema change invalidates it. One tool larger than REA_MCP_TOOLS_LIST_PAGE_BYTES fails with a resource_constraint error instead of a successful page. * test(doctor): keep the configuration table within its line limit The page-budget refusal stays covered by the setting parser tests. * fix(mcp): honor the tools/list page budget on the stdio path and register the setting Register REA_MCP_TOOLS_LIST_PAGE_BYTES in the numeric limit registry and the limit inventory so the numeric limit check passes. Carry the parsed page budget from AppConfig into DeferredEvidenceMcpServer so the default stdio startup path honors the setting instead of always using the 917504-byte default. Harden the page budget parser tests to surface the parse error instead of returning early on failure. * fix(mcp): return a fitting final tools/list page and use the parsed page budget verifiedPage returns the remaining tools as one final page without a cursor when they fit, instead of failing a resumed listing whose first tool plus a cursor exceeds the budget. parseConfig builds the page budget from parseEnvironment's admitted number instead of re-parsing the raw environment, and the now-unused resolveMcpToolsListPageBudget helper is removed. * fix(mcp): use shared isRecord in tools/list pagination Static checks flagged the local record predicate in toolListPagination.ts: import the shared isRecord from src/domain/isRecord.ts instead. The numeric-limit registry test still expected 15 entries after the REA_MCP_TOOLS_LIST_PAGE_BYTES entry was added; bump it to 16. * test(mcp): page tools/list fixtures under explicit small budgets The compact-only presentation strips field descriptions before advertising, so the 80-tool catalog fits one page and the oversized tool fits too. Set explicit small page budgets against the advertised size. The parseConfig success test now throws the typed error before reading the value, per the test guide. * test(config): throw typed parse errors in tools/list budget test Greptile P2 on #9142: the budget test checked the selected parse via an inline toMatchObject on the Result, hiding the typed error on failure. Bind both parse results and throw their errors before asserting values, per the repo test guide. * fix(mcp): format tools/list pagination test to repo style oxfmt --check flagged src/server/toolListPagination.test.ts (the cursor-identity expectation was written expanded; oxfmt collapses the two-element array onto one line). No behavior change. * style(mcp): oxfmt the page-budget assertion The Greptile P2 fix re-wrapped the expect call past oxfmt's width; run the pinned formatter so Static checks stays green. * fix(mcp): use the shared sha256Hex helper for the tools/list catalog digest The architecture guards forbid a second one-shot SHA-256 hex digest; use the shared helper from src/kernel/sha256Hex instead. * fix(mcp): build the tools/list page-budget refusal through the shared owner helper The architecture guard counts hand-built AnalysisResourceConstraintError constructions; toolsListPageBudgetError() held the only new copy. The refusal cause is a page budget, not a parse limit, so parseLimitConstraint does not fit. Add toolsListPageBudgetConstraint() beside it in parseFailureAnalysisError.ts and build the refusal from the page-budget facts there; the produced error is unchanged. Also give the pagination test SDK client the shared schema validator from createMcpSchemaValidation, released with the client. * fix(server): adapt instructions call to the predicate API Main changed serverInstructions to take an advertisesTool predicate instead of a tool-family set, and RecordedMcpCatalog gained required toolFamilies and promptRequirements fields. The merge head no longer typechecked, failing Build package, Documentation and Static checks. Adapt the call site to main's own adapter shape and add the two empty fixture fields. * fix(mcp): restore main's tool-family scope in deferred startup The merge dropped the family scoping main added to the deferred startup path. A scoped stdio start advertised every recorded tool and saved the full catalog identity, so attachRuntime rejected the selected identity on first use. Restore the toolFamilies option, scoped capabilities/instructions/identity, and the shared helper through runDeferred and the deferred constructor. * fix(mcp): share page limit facts and stream catalog sizing --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org>