Skip to content

perf(mcp): reuse output validators across catalog refreshes - #1433

Merged
N0zoM1z0 merged 1 commit into
mainfrom
perf/mcp-output-schema-cache-1065
Oct 10, 2026
Merged

N0zoM1z0 merged 1 commit into
mainfrom
perf/mcp-output-schema-cache-1065

Conversation

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

A complete tools/list refresh makes the pinned SDK prepare all output validators again. Schemas without an identity get recompiled even when their content is unchanged. Advertise a schema-local, content- and dialect-bound $id so clients reuse the existing Ajv compilation; changed schemas receive a new identity.

Refs #1065 and #723. The full tool inventory, input guidance, output schemas and validation rules remain available. Equivalent outputs can share a validator across tool names. Explicit IDs and relative external reference bases are preserved, and projections remain cached by their conversion target. SDK freshness, availability and reconnect handling remain responsible for choosing the current tool definition.

Validation on source 6c1c13f7, based on main 28595276, Node 24.18.0/npm 11.16.0, Linux x64 under the existing two-CPU resource guard:

  • 26 tests across seven files passed: SDK-converted schema validity/catalog parity, reordered registration, numeric/string constraints, dialects, explicit IDs, relative references, schema changes, availability transitions, reconnects, server identity and MCP doctor.
  • npm run check:fast, changed-file formatting, Git whitespace checks and npm run docs:check passed. Static checking uses the documented single-threaded compiler with its full scope preserved.
  • Actual compiled stdio REA workflows with SDK 2.3.1's default Ajv implementation: complete 139-tool discovery, directory analysis, retained-Evidence summary/module page, ping, close and reconnect passed. Only compiler/cache-hit counts were instrumented; no named toolDefinition shortcut was used.
  • Cold validator preparation compiles 118 distinct output schemas and reuses 21 equivalents. The next two catalog refreshes compile none; reconnecting the same client to a new REA process also compiles none for unchanged schemas. In the measured run, first binary_session took 2.74 seconds including 2.43 seconds of compilation, refresh calls took 114.6/29.6 ms, and the whole two-connection workflow took 9.60 seconds with 916 MiB peak process-family RSS.
  • Complete compact discovery grows from 1,870,570 to 1,884,470 bytes because of the identities. This is a validator CPU/recompilation improvement, not a reduction of model context or the complete catalog. Cold eager compilation of unrequested schemas remains an SDK follow-up.

Generated catalog/document outputs are ignored build artifacts and are not committed. No providers, executable bytes, Evidence/result representation or runtime authority change. Real Hopper/Ghidra runs are not applicable to this metadata change.

Advertise content- and dialect-bound identities for self-contained output schemas so the SDK can reuse unchanged Ajv validators after complete tools/list refreshes. Preserve explicit IDs and relative reference bases.

Verify changed schemas, availability transitions, reconnects, numeric and selector constraints, explicit IDs, relative references, and advertised dialects through the pinned SDK boundaries.

Refs #1065, #723
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@N0zoM1z0 N0zoM1z0 added area: mcp MCP server, transport, and tool registration enhancement New feature or request labels Oct 10, 2026
@N0zoM1z0
N0zoM1z0 merged commit dc5af6d into main Oct 10, 2026
19 checks passed
@N0zoM1z0
N0zoM1z0 deleted the perf/mcp-output-schema-cache-1065 branch October 10, 2026 04:49
N0zoM1z0 added a commit that referenced this pull request Oct 10, 2026
#1461)

Validate the target-free probe against the named definition discovered from the complete production catalog. Preserve initialized server and inventory observations when the SDK rejects the probe, and retain the schema failure reason, absolute deadline and owned-child cleanup.

The negative stdio replay regression fails on original main and passes the fix; actual production-boundary fault injection confirms rejection. Nine doctor/help tests, serial full static checks and real small-target CLI/MCP parity pass. Successful doctor reports remain byte-identical. No performance or model-token reduction is claimed.

Closes #1454. Refs #1065, #723, #1433.
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
…1433)

Advertise content- and dialect-bound identities for self-contained output schemas so the SDK can reuse unchanged Ajv validators after complete tools/list refreshes. Preserve explicit IDs and relative reference bases.

Verify changed schemas, availability transitions, reconnects, numeric and selector constraints, explicit IDs, relative references, and advertised dialects through the pinned SDK boundaries.

Refs morluto#1065, morluto#723
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
morluto#1461)

Validate the target-free probe against the named definition discovered from the complete production catalog. Preserve initialized server and inventory observations when the SDK rejects the probe, and retain the schema failure reason, absolute deadline and owned-child cleanup.

The negative stdio replay regression fails on original main and passes the fix; actual production-boundary fault injection confirms rejection. Nine doctor/help tests, serial full static checks and real small-target CLI/MCP parity pass. Successful doctor reports remain byte-identical. No performance or model-token reduction is claimed.

Closes morluto#1454. Refs morluto#1065, morluto#723, morluto#1433.
@morluto morluto added the performance Performance regressions, scaling limits, and bounded-resource work label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp MCP server, transport, and tool registration enhancement New feature or request performance Performance regressions, scaling limits, and bounded-resource work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants