ElicitAsync<T> throws where the untyped ElicitAsync succeeds under an outgoing-request interceptor
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- backend-api-design, testing
Research direction
Read src/ModelContextProtocol.Core/Server/McpServer.Methods.cs at the untyped and generic ElicitAsync overloads, especially the capability checks and interceptor handling. Compare the behavior with the interceptor and empty ClientCapabilities, then review the first interceptor-path test described in #1853; done means both overloads return the interceptor result without an unsupported-capability exception.
Written by the indexing model from the issue text.
Description
ElicitAsync<T> throws where the untyped ElicitAsync succeeds, when an outgoing-request interceptor is installed.
The untyped overload skips the capability check on purpose in that case, and records why (src/ModelContextProtocol.Core/Server/McpServer.Methods.cs:348-351):
Capability checks (ThrowIfElicitationUnsupported) are intentionally skipped because the interceptor's alternate channel is responsible for delivering the request to the client.
The generic overload runs the check itself before delegating (:414):
ThrowIfElicitationUnsupported(request);
var raw = await ElicitAsync(request, cancellationToken).ConfigureAwait(false);
So with an interceptor installed and a client that does not advertise elicitation, the untyped overload reaches the interceptor and the generic one throws Elicitation is not supported in stateless mode. Since WithOutgoingRequestInterceptor is how the Tasks package delivers outgoing requests, a server eliciting from a background task can use one API and not the other.
SampleAsync (:96-107) and RequestRootsAsync (:302-312) both test the interceptor before the capability check. ElicitAsync<T> is the only overload that does not.
Repro
Initialize a server with empty ClientCapabilities, install an interceptor, then call each overload. The untyped one returns the interceptor's result; the generic one throws.
Suggested fix
Drop the early check from the generic overload and let the untyped one run it, since it already handles both the interceptor and non-interceptor paths. That leaves one source of truth for the check and makes the generic overload match its two siblings.
On scope: WithOutgoingRequestInterceptor is MCPEXP002, so this is an inconsistency between two overloads of an experimental seam rather than a break in stable API. That path has no test coverage either. grep finds no reference to WithOutgoingRequestInterceptor anywhere under tests/.
#1853 implements that, with the first test to cover the interceptor path.
[!NOTE]
This issue was prepared with AI assistance.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/csharp-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
modelcontextprotocol/csharp-sdk#678 · 1 comment ·
-
enhancement needs confirmation P3 ready for work
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/csharp-sdk#515 · 6 comments · 3 reactions ·
All issues in modelcontextprotocol/csharp-sdk
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·