Repository navigation
fix(mcpx): gate form elicitation on the declaration sub-keys (#1757) - #2162
Conversation
CanElicit("form") returned true for any elicitation declaration, so a
2025-11-25+ host that declared only url mode was offered form
elicitations with a requestedSchema it never agreed to. From
2025-11-25 the form branch now parses the declaration: form is
sendable iff a form key is present or the declaration is empty ({}
is the form-only declaration); url-only is not form-capable and a
malformed declaration reads as undeclared. Below 2025-11-25 presence
of the capability remains the form declaration, unchanged.
Phase 3a of #1753 (form portion of #1757), per triage task 1980.
Lands on top of merged PR #2003 (Phase 1 sampling gate, same file).
Tests: declaration matrix extended in proto_test.go (url-only
refused at 2025-11-25+, form-only, both keys, {}, legacy, malformed).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 31 minutes. View limit details
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 955afec19e
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if json.Unmarshal(p.Caps["elicitation"], &e) != nil { | ||
| return false | ||
| } | ||
| return len(e.Form) > 0 || len(e.URL) == 0 |
There was a problem hiding this comment.
Preserve inline routing for URL-only clients
For a client on revision 2025-11-25 or later that declares only elicitation.url and no sampling, this change also makes AnswersInline() return false because it checks only CanElicit("form") || CanSample(). Consequently, canAsk in ask.go rejects the client and the request handlers bypass viaAsk, so supported URL questions are no longer relayed to that client, even though CanElicit("url") still returns true. Keep the stricter form check, but also include URL capability in AnswersInline() so URL-only clients retain their supported elicitation flow.
Useful? React with 👍 / 👎.
Fixes the form portion of #1757 (Phase 3a of #1753), per triage task 1980. Queue task 2004.
Change (
pkgs/mcpx/internal/mcpserver/conn.go,CanElicit): the form branch no longer returns true for any elicitation declaration. At peer revision ≥ 2025-11-25 it parses the declaration — form is sendable iff aformkey is present or the declaration is empty ({}is the form-only declaration); a url-only declaration is not form-capable, and a malformed declaration reads as undeclared (mirroring the url branch). Below 2025-11-25, presence of the capability remains the form declaration, unchanged. The url branch, roots behaviour and upstream declarations are untouched;AnswersInlineinherits the corrected answer viaCanElicit("form").Sequencing: gated on Phase 1 (PR #2003, same file) — that PR merged 2026-10-29T05:48Z, and this branch is based on current main including it. No parallel conn.go edit.
Tests: the declaration matrix in
proto_test.gogains six cases — url-only refused at 2025-11-25+, form-only, both keys,{}(form allowed), legacy 2025-06-18 url-only (form allowed), malformed (undeclared). Full suite runs in CI (go test ./...for pkgs/mcpx).Need help on this PR? Tag
@codesmith-botwith what you need.