Skip to content

mcp: do not ApplyDefault when res.Content==nil - #1069

Merged
guglielmo-san merged 1 commit into
mainfrom
guglielmoc/elicit_panic
Jul 10, 2026
Merged

guglielmo-san merged 1 commit into
mainfrom
guglielmoc/elicit_panic

Conversation

@guglielmo-san

Copy link
Copy Markdown
Contributor

Fixes #1062

@guglielmo-san
guglielmo-san merged commit ce393ac into main Jul 10, 2026
9 checks passed
@guglielmo-san
guglielmo-san deleted the guglielmoc/elicit_panic branch July 10, 2026 09:26
guglielmo-san pushed a commit that referenced this pull request Oct 5, 2026
A `tools/call` request with `"arguments": null` for a tool whose input
schema declares a default panics the server with `assignment to entry in
nil map`. Unmarshaling `null` into the map in `applySchema` leaves it
nil, and `ApplyDefaults` then writes into it.

This treats null arguments like missing ones, so the defaults are
applied and the call proceeds.

The elicitation paths already skip `ApplyDefaults` on a nil `Content`
(#1069), so `applySchema` is the only place that needed the check.

The two new `TestApplySchema` cases panic on `main`.

Fixes #1340
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ServerSession.Elicit: accept response without content panics the server ("assignment to entry in nil map")

2 participants