mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
`id` is optional in JSON-RPC and may legitimately be `null`. The previous
`int(payload.get("id", 0))` only defaults when the key is absent — a present
`"id": null` reaches `int(None)` and raises TypeError. The exception
propagates out of the message handler, the MCP handshake never completes, and
the session is left with ready=False (no device tools) and no clear error.
Use `or 0` so both the missing-key and explicit-null cases collapse to 0.
Applies to the result and error branches.
|
||
|---|---|---|
| .. | ||
| base | ||
| device_iot | ||
| device_mcp | ||
| mcp_endpoint | ||
| server_mcp | ||
| server_plugins | ||
| __init__.py | ||
| unified_tool_handler.py | ||
| unified_tool_manager.py | ||