Critical: Call failure on MCP tool changes
# support
b
I'm receiving the following message in the call log:
Model request failed (attempt #1, reason: Invalid 'tools[2].function.name': empty string. Expected a string with minimum length 1, but got an empty string instead.)
Here's the thing: I haven't changed the MCP server between VAPI tool updates - the tool names are not missing; they're named. I've gone to the simplest version of the tool update I can:
Copy code
type: "mcp",
    server: {
      url: process.env.MCP_SERVER_URL!,
      headers: {
        "x-organization-id": organizationId,
        "x-api-token": mcpToken,
      },
    },
I'm unable to determine the cause of the error, but it does seem to be somehow related to the
client.tools.create
call, and what is being fed into it. Sometimes everything's fine, sometimes it's not. Sometimes it works on create, but is resolved with an update, sometimes the other way around. It's permanent until I change some config around and retry, but it's a toss-up as to whether that will work. Logs on my MCP server show valid requests and responses with tool names in the fields. It's worth noting that this could be an off-by-one issue: I only have two tools on the MCP server right now, so
tools[2]
shouldn't be a valid index. Earlier, when I had four tools, it was throwing an error with
tools[4]
. Unless the indexing is 1-based, this is incorrect. Any insight into what might be causing this? It's preventing our product launch. You can see a call id at
c267e1fa-b92b-4948-99d5-efb377bb7c37
.
Here's a call id that worked:
d7eda0ae-c488-4185-91a5-1d01a7891833
. Nothing changed in the tool. I did add a backoff plan, but subsequent tests with the same backoff plan object (after a PATCH) failed.
I've done a bit further work here, and I have a workaround, but for the life of me I can't figure out why this should matter. This is a bug related to specifying a custom
analysisPlan
when creating/updating an agent. If I don't include exactly
\n\nJson Schema:\n{{schema}}\n\nOnly respond with the JSON.
at the end of my custom prompt and exactly this second message:
Copy code
{
    role: "user",
    content: "Here is the transcript:\n\n{{transcript}}\n\n. Here is the ended reason of the call:\n\n{{endedReason}}\n\n",
},
Then any calls will immediately crash with the error that I opened the post with. Including these pieces allows my assistant to respond and prevents crashes. Both pieces of data are required. If there's a space between the newlines and the word "Json", the call will crash. If there is a missing character, the call will crash I'm assuming there's some side effect or bug in the merge logic. I was able to find this by diffing the fetch from /assistant/[id] before and after saving through the VAPI UI.
@User - anything here? We have an imminent launch, and knowing exactly what caused this so I can avoid it would be ideal.
c
Hey BuckAMazying, Thank you for reaching out. Please note that our team does not operate over the weekend. We’ll be back in the office on Monday and will dive straight into your issue then to determine the best way forward.
Hey BuckAMazying, thanks for sharing the call ids and your work around that's really helpful. I have forwarded the issue to the team, and once I have any updates from their side, I'll let you know.
b
Got it. Thanks.
Note: this also seems to occur if
assistant.server.timeoutSeconds
is not specified. I get a
200
on the call, but it does crash at call time.
c
Hey BuckAMayzing, Thanks for reaching out! We're currently swamped with a bunch of tickets and it's taking us longer than usual to get back to everyone. I know waiting isn't fun, but we want to make sure we give your issue the attention it deserves rather than rushing through it. We'll circle back with you soon to get this sorted out.
3 Views