Summary
The client.callTool invocation in src/lib/voice/livekit/realtimeMcpTools.ts (around line 183) lacks a bounded timeout and AbortSignal. A stalled MCP server will hang the realtime voice turn indefinitely, delaying or omitting the tool-result event.
Proposed Fix
Pass a third RequestOptions argument to client.callTool (supported by @modelcontextprotocol/sdk):
const result = await client.callTool(
{ name: mcpTool.name, arguments: args ?? {} },
undefined, // use the default result schema
{ timeout: 30_000 } // 30 s hard cap per tool call
);
Optionally, thread an AbortSignal for cancellability when the user interrupts:
{ timeout: 30_000, signal: someAbortController.signal }
Alternatively, apply the withTimeout pattern already used in src/lib/mcp/toolDiscoveryService.ts.
References
Summary
The
client.callToolinvocation insrc/lib/voice/livekit/realtimeMcpTools.ts(around line 183) lacks a bounded timeout andAbortSignal. A stalled MCP server will hang the realtime voice turn indefinitely, delaying or omitting thetool-resultevent.Proposed Fix
Pass a third
RequestOptionsargument toclient.callTool(supported by@modelcontextprotocol/sdk):Optionally, thread an
AbortSignalfor cancellability when the user interrupts:Alternatively, apply the
withTimeoutpattern already used insrc/lib/mcp/toolDiscoveryService.ts.References