Facing Issue to handle multiple tools
# support
n
Guys, I am posting this query again!! I attach both the tool Id in my assistant but how can I tell to assistant to first check the checkAvailableSlots Tool and get response the behave if slot available then only bookappointmentTool should work
v
Hi Nidhi! 👋 I understand you're trying to set up your assistant to first check for available slots before booking an appointment. I can't see your specific implementation details, but I can definitely help with how to configure your Vapi assistant to execute tools conditionally! Here's how you can make your assistant first check available slots and only book if slots are available: ## 1. Update Your Assistant's Prompt The most straightforward approach is to update your assistant's prompt to explicitly instruct it to check availability first. According to the [Vapi documentation](https://docs.vapi.ai/prompting-guide), you should include clear instructions like:
Copy code
When a user wants to book an appointment:
1. ALWAYS use the checkAvailableSlots tool first to verify availability
2. ONLY use the bookappointmentTool if slots are available
3. If no slots are available, inform the user and suggest alternatives
## 2. Access Tool Response Results To make decisions based on the
checkAvailableSlots
tool response, your assistant needs to access the result. The tool response will be in this format:
Copy code
json
{
  "results": [
    {
      "toolCallId": "call_123456789",
      "result": "The following timeslots are available: 2025-04-04T14:00:00-05:00,2025-04-04T14:30:00-05:00"
    }
  ]
}
Your assistant can then parse this response to determine if slots are available before proceeding to booking. ## 3. Implement Server-Side Logic For more robust control, you can implement conditional logic on your server. According to [Vapi's documentation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333245023319494707), when Vapi sends a server request to your server, you can analyze the payload from the
checkAvailableSlots
tool and conditionally trigger the
bookappointmentTool
based on the results. ## 4. Example Workflow Here's a typical workflow for appointment booking: 1. Collect user's preferred date and time
2. Call the
checkAvailableSlots
tool 3. If slots are available, proceed to call the
bookappointmentTool
4. If no slots are available, inform the user and suggest alternatives This approach is mentioned in the [appointment setter documentation](https://docs.vapi.ai/prompting-guide#appointment-setter). Would you like me to elaborate on any specific part of this process? Or do you need help with implementing any of these approaches? Sources: - [Vapi documentation](https://docs.vapi.ai/prompting-guide) - [Discord discussion](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333245023319494707) - [Appointment setter documentation](https://docs.vapi.ai/prompting-guide#appointment-setter)
v
Message marked as helpful by @Nidhi Sharma! 🎉
k
checking if this is resolved/solved for you?
2 Views