Programmatically add MCP tools to Assistant
# support
j
So, I want to add more MCP Tools to my Assistant, but want to do this within my code (since I want to add/change headers depending on the user). I thought that, after looking at the docs (https://docs.vapi.ai/api-reference/webhooks/server-message), this would the way to do this, but I can't seem to make it work:
Copy code
Python
"messageResponse": {
    "assistantId": "id",
    "assistantOverrides": {
        "firstMessage": f"Hi Joris, how are you doing?",
        "serverMessages": ["tool-calls"],
        "transcriber": {
            "provider": "deepgram",
            "model": "nova-2",
            "language": "multi",
        },
        "model": {
            "provider": "openai",
            "model": "gpt-4o-mini",
            "tools": [
                {
                    "type": "mcp",
                    "name": "google-calendar-mcp",
                    "description": "Google Calendar MCP for Joris personal Google Account",
                    "server": {
                        "url": "https://server-url/prd/sse",
                        "headers": {
                            "type": "array",
                            "items": [
                                {"x-google-client-id": "client-id"},
                                {"x-google-client-secret": "client-secret"},
                                {"x-google-redirect-uri": "url"},
                                {"x-google-refresh-token": "refresh-token",
                            ],
                        }
                    },
                    "metadata": {
                        "protocol": "sse",
                    }
                }
            ]
        }
    },
}
So my question is, is this allowed, and if so, how do I make sure this works?
2 Views