[BUG] MCP GetLiveContext domain parameter fails: anyOf string/array schema serialized as invalid JSON
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Description
The domain parameter on the Home Assistant MCP tool GetLiveContext consistently
fails with an InputValidationError. The name parameter (plain string schema) works
correctly. Tested on Claude Code 2.1.187 and 2.1.190 — not fixed by the update.
Error
InputValidationError: mcp__homeassistant__GetLiveContext was called with input that could not be parsed as JSON.
You sent (first 17 of 17 bytes): {"domain": light}
The string value light is emitted without quotes, producing invalid JSON.
Parameter schema
The domain parameter uses this schema:
{
"anyOf": [{}, {"items": {"type": "string"}, "type": "array"}],
"description": "Filter entities by domain (e.g. 'light', 'sensor'). Accepts a single domain or a list."
}
The anyOf shape (accepting either a bare value or a typed array) appears to trigger
incorrect serialization — string values are emitted unquoted.
Steps to reproduce
- Connect the Home Assistant MCP server
- Call
GetLiveContextwithdomain: "light"(or any domain string) - Call fails every time with the above error
What works
Calling GetLiveContext with name: "some entity name" (a plain string schema
parameter) succeeds.
Versions
- Claude Code: 2.1.190 (also reproduced on 2.1.187)
- Platform: macOS (darwin)
Related issues
- #22394 — Array parameters serialized as strings instead of arrays (locked)
- #24599 — MCP tool parameters with non-string types serialized as strings (locked)
````
What Should Happen?
GetLiveContext should be called with {"domain": "light"} — the string value properly quoted — and should return all exposed Home Assistant entities matching that domain. The anyOf schema on the domain parameter should not affect how string values are serialized.
Error Messages/Logs
InputValidationError: mcp__homeassistant__GetLiveContext was called with input that could not be parsed as JSON.
You sent (first 17 of 17 bytes): {"domain": light}
Steps to Reproduce
- Connect the Home Assistant MCP server
- Call GetLiveContext with domain: "light" (or any domain string)
- Call fails every time with the above error
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.190
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_