Skip to content

fix(mcp): support large tool catalogs - #2086

Merged
zerob13 merged 1 commit into
devfrom
codex/mcp-tool-list-compat
Aug 5, 2026
Merged

fix(mcp): support large tool catalogs#2086
zerob13 merged 1 commit into
devfrom
codex/mcp-tool-list-compat

Conversation

@zerob13

@zerob13 zerob13 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • validate tools/list complexity per tool while retaining collection byte and depth limits
  • preserve bounded legacy schemas for user-owned external legacy servers
  • keep modern, built-in, and plugin-owned schema validation strict
  • avoid v2-only output-schema compilation for legacy tool calls
  • cover direct discovery, pagination, ToolManager registration, and MCP Apps

Testing

  • pnpm run format:check
  • pnpm run i18n
  • pnpm run lint
  • pnpm run typecheck
  • pnpm exec vitest run --config vitest.config.ts test/main/mcp (199 passed, 2 skipped)

Closes #2085

Summary by CodeRabbit

  • Bug Fixes

    • Improved compatibility with large MCP tool catalogs, including catalogs with many tools and properties.
    • Preserved schemas from external legacy connections while maintaining safety limits.
    • Prevented unsupported output-schema data from being sent to external legacy servers.
    • Added clearer validation for modern and packaged schemas, including references, depth, size, and structure limits.
  • Documentation

    • Documented large-catalog compatibility behavior, validation rules, limits, and failure handling.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d3d94c12-bf7d-4b54-b6d8-f6fd6f83696e

📥 Commits

Reviewing files that changed from the base of the PR and between 710af0d and 1ddc458.

📒 Files selected for processing (9)
  • docs/architecture/mcp-v2-protocol/spec.md
  • docs/issues/mcp-large-tool-catalog-compatibility/spec.md
  • src/main/mcp/apps/appHost.ts
  • src/main/mcp/mcpClient.ts
  • src/main/mcp/schemaValidation.ts
  • test/main/mcp/mcpAppHost.test.ts
  • test/main/mcp/mcpClient.test.ts
  • test/main/mcp/schemaValidation.test.ts
  • test/main/mcp/toolManager.test.ts

📝 Walkthrough

Walkthrough

The MCP implementation now validates large tool catalogs with independent item limits, applies strict or legacy schema policies by connection type, preserves external legacy schemas, and omits legacy output schemas from tool calls. Specifications and regression tests document and verify the behavior.

Changes

MCP catalog compatibility

Layer / File(s) Summary
Bounded schema validation
src/main/mcp/schemaValidation.ts, test/main/mcp/schemaValidation.test.ts
JSON cloning now supports independent array-item budgets. Tool validation selects strict or legacy schema handling. Tests cover size, key, cycle, dialect, and reference behavior.
Client catalog and call integration
src/main/mcp/mcpClient.ts, src/main/mcp/apps/appHost.ts, test/main/mcp/mcpAppHost.test.ts, test/main/mcp/toolManager.test.ts
Tool-list responses apply independent item limits and connection-specific schema policies. External legacy calls omit outputSchema. Large catalogs are loaded and registered in full.
Compatibility specification and integration coverage
docs/architecture/mcp-v2-protocol/spec.md, docs/issues/mcp-large-tool-catalog-compatibility/spec.md, test/main/mcp/mcpClient.test.ts
The specifications define modern and external legacy behavior. Tests cover large catalogs, legacy schema preservation, and strict schema rejection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant MCPServer
  participant MCPClient
  participant schemaValidation
  participant ToolManager
  MCPServer->>MCPClient: Return tools/list response
  MCPClient->>schemaValidation: Validate bounded response and tool schemas
  schemaValidation-->>MCPClient: Return cloned tools
  MCPClient->>ToolManager: Register discovered tools
  MCPClient->>MCPServer: Call tool without outputSchema for external legacy connections
Loading

Suggested reviewers: yyhhyyyyyy

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: MCP now supports large tool catalogs.
Linked Issues check ✅ Passed The changes address issue #2085 by removing catalog-wide validation barriers and adding coverage for loading large 151-tool catalogs.
Out of Scope Changes check ✅ Passed The code, documentation, and tests support large-catalog compatibility and related legacy-schema handling described in the PR objectives.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/mcp-tool-list-compat

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zerob13
zerob13 marked this pull request as ready for review August 5, 2026 10:09
@zerob13
zerob13 merged commit 6567fb6 into dev Aug 5, 2026
16 of 18 checks passed
@zhangmo8
zhangmo8 deleted the codex/mcp-tool-list-compat branch August 6, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] stdio MCP server tools/list fails silently when response is large (0 tools loaded, server shows "connected")

1 participant