MCP
This guide shows how to integrate the AgentDuet SDK with the Model Context Protocol (MCP) so live speech agents can call structured tools over a shared tool surface during phone calls.
Sample: OmniBank phone servicing (authenticate, fees, escalate).
Demo caller: Ava Chen, card ending 4821.
What this integration provides
- AgentDuet answers inbound calls and streams PCM to Gemini Live
- Gemini Live declares tools from an MCP server’s
list_toolsresult - Tool calls dispatch to the MCP server over stdio (
call_tool) - Swap
mcp_tools_server.pyto change capabilities without touching call wiring
How the pieces fit
Prerequisites
- Python 3.12+
- AgentDuet API key and connector UUID from agentduet.com
- Gemini API key
Step 1: Clone the sample
Layout:
Step 2: Install
The sample pins agentduet==1.0.0.
Step 3: Configure .env
Step 4: Run
main.py spawns mcp_tools_server.py over stdio, loads tool declarations into
Gemini Live, then waits for calls.
Call your AgentDuet number. Say you are Ava Chen, card ending 4821.
Tools
How AgentDuet and MCP connect
- On startup, the app opens an MCP stdio client to
mcp_tools_server.py. list_toolsbecomes GeminiFunctionDeclarations (JSON Schema keys Gemini rejects are stripped).- On each inbound call, AgentDuet answers and Gemini Live streams audio.
- When the model emits a tool call, the app runs
call_tooland returns the result withsend_tool_response. - Hangup closes the Gemini session; the MCP server process stays up for the next call.
