Repository navigation
ElicitParams serializes an unset Mode as "mode": "" #1072
Description
Describe the bug
When a server returns an InputRequiredResult containing a form-mode ElicitRequest with an unset ElicitParams.Mode, the Go SDK serializes the field as "mode": "".
The draft schema permits form-mode elicitation to either omit mode or set it to "form". An empty string matches neither the form nor the URL branch of ElicitRequestParams, so the nested ElicitRequest does not validate against the schema.
Omitting mode when it is unset would preserve the specification's backward-compatible form-mode default.
Environment tested:
v1.7.0-pre.2(b426fbf)- Server used:
conformance/everything-server - Transport: stdio (
2026-07-28draft)
To Reproduce
- Start the Go SDK conformance server over stdio using the 2026-07-28 draft protocol revision.
- Send a
prompts/getrequest for thetest_input_required_result_promptprompt:
{
"jsonrpc": "2.0",
"id": 1001,
"method": "prompts/get",
"params": {
"name": "test_input_required_result_prompt",
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientInfo": {"name": "test-client", "version": "1.0.0"},
"io.modelcontextprotocol/clientCapabilities": {}
}
}
}- Observe that the response contains
"mode": ""in the nestedElicitRequestparams:
{
"jsonrpc": "2.0",
"id": 1001,
"result": {
"messages": null,
"resultType": "input_required",
"inputRequests": {
"user_context": {
"method": "elicitation/create",
"params": {
"mode": "",
"message": "Please provide context for the prompt",
"requestedSchema": {
"type": "object",
"properties": {"context": {"type": "string"}},
"required": ["context"]
}
}
}
}
}
}Expected behavior
The mode field should be omitted when Mode is unset. Per the specification, clients treat an omitted mode as form mode. Explicitly serializing "mode": "form" would also be schema-valid.
Expected params:
{
"message": "Please provide context for the prompt",
"requestedSchema": {
"type": "object",
"properties": {
"context": {
"type": "string"
}
},
"required": ["context"]
}
}ElicitRequestParams is defined as either ElicitRequestFormParams or ElicitRequestURLParams.
- In the form branch,
modeis optional, but when present its value must be"form". - In the URL branch,
modeis required and its value must be"url".
Therefore, "mode": "" matches neither branch, while omitting mode matches the form branch.
Additional context
ElicitParams.Mode in mcp/protocol.go is declared as:
Mode string `json:"mode"`- Related issues:
- Proposal: API additions for the 2025-11-25 spec (in v1.2.0-pre.1) #725 introduced the relevant elicitation API additions, including
ElicitParams.Mode. - modelcontextprotocol#1885 discussed making form-mode
moderequired and was closed after maintainers clarified that omission is intentional for backward compatibility.
- Proposal: API additions for the 2025-11-25 spec (in v1.2.0-pre.1) #725 introduced the relevant elicitation API additions, including
Activity
guglielmo-san commentedon Jul 13, 2026
@cclabadmin thank you for reporting, fixed in PR #1078
mcp: infer elicit mode from ElicitParams (modelcontextprotocol#1078)