busy-lunch-15701
10/17/2025, 4:23 AMtall-airline-16756
10/17/2025, 4:23 AMtall-airline-16756
10/17/2025, 4:24 AMAgentSession is usually set up during initialization, and there isn’t a documented method like update_mcp_servers() to change that list on the fly. Since the mcp_servers property is read-only, you can’t assign to it directly.
That said, you can definitely update tools from MCP servers dynamically using the update_tools() method. A great way to do this is by preparing tools from new MCP servers with helper methods like MCPToolsIntegration.prepare_dynamic_tools(), and then adding them through update_tools().
If you have any more questions or a particular scenario you’re working with, please don’t hesitate to ask—I’m here to help!
Sources: README.md | Agent Session & Client Integration | livekit/livekit_composite | DeepWiki | Tool definition and use | LiveKit Docs | agent.pybusy-lunch-15701
10/17/2025, 4:26 AMtall-airline-16756
10/17/2025, 4:28 AMAgentSession constructor using the mcp_servers parameter. This way, the tools will be automatically loaded and managed for you within the session—making things much smoother!
2. Manual Tool Extraction and Registration:
If you prefer having more control, you can use the MCPToolsIntegration.prepare_dynamic_tools() method to extract tools from MCP servers, and then register them with your agent using update_tools(). This method also includes solid error handling and lets you tweak the tools before adding them.
If you'd like, I’d be happy to walk you through the detailed steps for either option—just let me know how I can help!
Sources: Tool definition and use | LiveKit Docs | complex-agents/shopify-voice-shopper/shopify.py | README.mdbusy-lunch-15701
10/17/2025, 4:29 AMMCPToolsIntegration.prepare_dynamic_tools()tall-airline-16756
10/17/2025, 4:30 AMMCPToolsIntegration.prepare_dynamic_tools() function comes from an example repository that shows how MCP integration works with LiveKit agents. It’s not actually part of the main LiveKit Python SDK.
Here’s where you can find it:
- Repository: https://github.com/livekit-examples/basic-mcp
- File: mcp_client/agent_tools.py
This function is designed to fetch tools from multiple MCP servers and get them ready for use with LiveKit agents. If you’d like, I’m here to help you integrate this into your project—just let me know!
Sources: mcp_client/agent_tools.py | livekit-agents/livekit/agents/llm/mcp.py | Tool definition and use | LiveKit Docs