Can I make local tool calls with the vapi web sdk?
# support
d
Not seeing any docs for local tool calls eg the agent sends a message to the web sdk to tell the browser to call a tool and what params to use Example { "tool_call": { "name": "do_something", "params": { "key": "value" } } } then the client makes the tool call and returns a result to the agent { "tool_call_result": { "name": "do_something", "result": { "success": "true" } } }
I setup the server based tool calls and I can use the client side message to trigger the tool which is weird can I just use client side tool calls without a server?
Copy code
{
  "type": "tool-calls",
  "toolCalls": [
    {
      "id": "call_e5UMNx9R0HazLoe5uvmOOvxk",
      "type": "function",
      "function": {
        "name": "next_question",
        "arguments": {
          "ready": true
        }
      }
    }
  ],
  "toolCallList": [
    {
      "id": "call_e5UMNx9R0HazLoe5uvmOOvxk",
      "type": "function",
      "function": {
        "name": "next_question",
        "arguments": {
          "ready": true
        }
      }
    }
  ],
  "toolWithToolCallList": [
    {
      "type": "function",
      "function": {
        "name": "next_question",
        "parameters": {
          "type": "object",
          "required": [
            "ready"
          ],
          "properties": {
            "ready": {
              "type": "boolean",
              "description": "Whether to proceed to next question"
            }
          }
        },
        "description": "Move to the next question in the interview after saving an answer"
      },
      "server": {},
      "messages": [],
      "toolCall": {
        "id": "call_e5UMNx9R0HazLoe5uvmOOvxk",
        "type": "function",
        "function": {
          "name": "next_question",
          "arguments": {
            "ready": true
          }
        }
      }
    }
  ]
}
if I remove the server part of the tool it stops working locally if I add it back with a fake url I can get it working client side tho
Copy code
"tools":[
   {
      "type":"function",
      "function":{
         "name":"save_answer",
         "description":"Save the user\\'s answer to the current interview question",
         "parameters":{
            "type":"object",
            "properties":{
               "question":{
                  "type":"string",
                  "description":"The question that was asked"
               },
               "answer":{
                  "type":"string",
                  "description":"The complete answer from the user"
               },
               "category":{
                  "type":"string",
                  "description":"The category of the question (e.g., Core Identity, Values, etc.)"
               }
            },
            "required":[
               "question",
               "answer",
               "category"
            ]
         },
         "server":{
            "url":"https://example.com/not-used",
            "secret":"not-used"
         }
      }
   },
c
Hey DamienM, if the local tool calls are working with a fake serverUrl can you confirm that and do you still require additional support for this issue?
d
Wondering if there is a way to get it working without the need for the fake server url I think it adds latency to the bot because it keeps saying "hold on a second" etc
c
There might be a timeout property that you could set really short so that it just closes the request sooner and proceeds with the rest of the prompt. Try adding the
timeout
property in the server object and see where that gets you
4 Views