feat(agent-core-v2): support per-server deferred disclosure of MCP tools - #3455
feat(agent-core-v2): support per-server deferred disclosure of MCP tools#3455sailist wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: fc3b658 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b18d344bdf
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| const McpServerCommonFields = { | ||
| enabled: z.boolean().optional(), | ||
| deferred: z.boolean().optional(), |
There was a problem hiding this comment.
Mirror
deferred in the public client schemas
When callers configure an MCP server through @moonshot-ai/klient or the v2 node SDK, this option cannot reach the new engine field: packages/klient/src/contract/mcp.ts omits deferred, and Klient's Zod input/output parsing strips unknown properties before sending or returning configs; the node SDK also routes these operations through that contract. Consequently session-ephemeral, add/update, and test calls silently revert to the default deferred behavior, while reading and subsequently updating an existing deferred: false config can erase the setting. Add the field to the mirrored client schema/types and preserve it through node SDK validation.
AGENTS.md reference: AGENTS.md:L30-L30
Useful? React with 👍 / 👎.
Related Issue
No linked issue — internal feature request (per-server control over deferred MCP tool disclosure).
Problem
The experimental progressive tool disclosure (
tool-selectflag + a model that declaresdynamically_loaded_tools) defers every MCP server's tools: none of them appear in the top-leveltools[], and the model must load each one on demand viaselect_tools. There is no way to pin a specific server's tools inline — for example a core server whose tools the model should see without aselect_toolsround-trip, while the rest stay deferred to preserve the prompt cache.What changed
deferredboolean. With the tool-select gate active, servers default to deferred as before;deferred: falsekeeps that server's tools inline in the top-level tool list. The field is ignored while the gate is off, and v1 config parsing ignores the unknown key as well.deferredby default,inlinefor opted-out servers. The synthetic OAuth authenticate tool stays deferred, matching current behavior.source === 'mcp'as dynamically loadable. Default behavior is unchanged; the deferral decision is now an explicit registration-time declaration.deferred: falseservers, and shaping/manifest behavior for inline tools; existing fixtures updated to the explicit-disclosure registration contract. Docs (en/zh) document the field; changeset included.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.