Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mcp/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (m *InputRequestMap) UnmarshalJSON(data []byte) error {
Method string `json:"method"`
Params json.RawMessage `json:"params"`
}
var rawMap map[string]*raw
var rawMap map[string]raw
if err := json.Unmarshal(data, &rawMap); err != nil {
return err
}
Expand Down
7 changes: 7 additions & 0 deletions mcp/protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,13 @@ func TestInputRequestMapJSON(t *testing.T) {
t.Error("expected key r1 in InputRequests")
}
})

t.Run("null entry is rejected", func(t *testing.T) {
var got CallToolResult
if err := json.Unmarshal([]byte(`{"content":[],"inputRequests":{"r1":null}}`), &got); err == nil {
t.Error("Unmarshal succeeded, want an error for a null input request")
}
})
}

func TestInputResponseMapJSON(t *testing.T) {
Expand Down
Loading