🦥 feat: Server-Level deferLoading Default for MCP Servers#68
Open
sindriii wants to merge 2 commits into
Open
Conversation
Add an optional per-MCP-server `deferLoading: boolean` config flag so all of a server's tools default to deferred loading: the model receives the `tool_search` tool plus a name-only listing instead of each tool's full schema. Saves context on large tool sets and, unlike the per-agent `tool_options` toggle, applies to ephemeral (model + attached MCP) agents. - Schema: `deferLoading` on `BaseOptionsSchema` (packages/data-provider) - Precedence: per-agent `tool_options[toolId].defer_loading` (true OR false) wins; else server `deferLoading`; else false. Gated by the existing `deferred_tools` agent capability. - Mechanism: per-tool `serverDeferLoading` stamp applied at the tool-registry build (live path via MCP tool factory; event-driven path via a new `getServerDeferLoading` resolver), so ephemeral + saved agents + the `mcp_all` placeholder all defer uniformly. - UI: three-state checkbox reflecting the inherited server default. - Tests: classification precedence matrix, event-driven parity, schema parse, and client hook three-state behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Add `deferLoading` to `ADMIN_CONFIGURABLE_FIELDS` so a config-tier override that changes only `deferLoading` on a YAML-defined server is no longer treated as identical to its YAML base (which would skip the override). Keeps the merged-config source of truth honoring admin overrides for this field. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional per-MCP-server
deferLoading: booleanconfig flag so all of a server's tools default to deferred loading: the model receives thetool_searchtool plus a name-only listing instead of each tool's full schema. Saves context on large tool sets and — unlike the existing per-agenttool_optionstoggle — applies to ephemeral agents (plain model + attached MCP), which carry notool_optionsand previously could never defer.This extends the maintainer's own
deferred_toolscapability (danny-avila#11295) to the server-config level and the ephemeral path. It composes with, and is complementary to, the proposed MCPtoolFilter(danny-avila#13346 / issue danny-avila#11088): filtering selects which tools exist;deferLoadingdefers their schemas.Behavior
deferLoadingonBaseOptionsSchema(packages/data-provider/src/mcp.ts); optional, defaults toundefined/false — fully backward compatible.tool_options[toolId].defer_loading(true OR false) wins; else serverdeferLoading; else false. Gated by the existingdeferred_toolsagent capability (capability off ⇒ no deferral, notool_search).serverDeferLoadingstamp applied at the tool-registry build:MCP.js) from the resolved merged server config.definitions.tsvia a newgetServerDeferLoadingresolver wired throughToolService.js.classification.ts) reads the stamp, so saved agents, ephemeral agents, and themcp_allplaceholder all defer uniformly.Tests
classification.spec.ts— precedence matrix (server default applies, ephemeral fallback, explicit override wins, capability-off clears, mixed servers, stamp extraction).definitions.spec.ts— event-driven parity with the live path;tool_searchinjection on a server default with no per-agent options.packages/data-provider/src/mcp.spec.ts— schema parse / optional / reject.useMCPToolOptions.spec.ts— three-state inheritance + collapse-to-default.Notes for review
@librechat/agents(keyed offdefer_loading); the repo-boundary guard here is the classification/definitions tests proving server-defaulted tools carrydefer_loading: trueinto the registry the agents lib consumes.librechat.example.yamldocuments the new option.🤖 Generated with Claude Code