Commit a500962
committed
fix: add missing MCP server events to beta Realtime client event union
The beta Realtime client (`client.beta.realtime.connect()`) uses
`types/beta/realtime/realtime_server_event.py` as the discriminated union
for parsing incoming WebSocket events. This union was missing all eight MCP
lifecycle event types that the server emits when MCP tools are configured:
mcp_list_tools.in_progress
mcp_list_tools.completed
mcp_list_tools.failed
response.mcp_call.in_progress
response.mcp_call.completed
response.mcp_call.failed
response.mcp_call_arguments.delta
response.mcp_call_arguments.done
Because the discriminated union had no entry for these event types, any MCP
event sent by the server could not be matched during parse_event(), causing
pydantic to fail silently or raise a validation error. The practical effect
is that MCP tool calls appear to do nothing: the server executes the tool,
emits the lifecycle events, and the client drops them without dispatch.
The same types already exist in `types/realtime/` (the non-beta path) and
are fully covered there. This commit re-exports them into
`types/beta/realtime/realtime_server_event.py` by importing from the shared
location and registering them in both `__all__` and the `RealtimeServerEvent`
union.
Fixes #31281 parent e507a4e commit a500962
1 file changed
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
41 | 49 | | |
42 | 50 | | |
43 | 51 | | |
44 | 52 | | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
48 | 64 | | |
49 | 65 | | |
50 | 66 | | |
| |||
128 | 144 | | |
129 | 145 | | |
130 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
131 | 155 | | |
132 | 156 | | |
133 | 157 | | |
0 commit comments