Custom Calendar tools
# support
c
Hello, i create custom calendar tools i do that if not events: return { "result": f"Perfect! {date_formatted} is completely open from {time_min} to {time_max}. What time works for you?", "available": True, "timeSlots": [ { "start": f"{date}T{time_min}:00", "end": f"{date}T{time_max}:00" } ] } else: available_slots = find_available_slots(events, date, time_min, time_max) time_slots = [] for slot_time in available_slots[:4]: slot_start = datetime.strptime(f"{date} {slot_time}", "%Y-%m-%d %H:%M") slot_end = slot_start + timedelta(hours=1) time_slots.append({ "start": slot_start.isoformat(), "end": slot_end.isoformat() }) slots_text = ", ".join(available_slots[:4]) return { "result": f"I have these times on {date_formatted}: {slots_text}. Which works best?", "available": True, "timeSlots": time_slots } but it says : It seems I'm having trouble checking availability for that date. Could you please provide another date? Or let me know if mornings or afternoons work better for you? My calendar credentials etc is ok i got 0 events it s a new one but seems not work what is the return format VAPI want for Check Calendar Availability and same for Create event ? Thank you
v
Vapi expects your custom tool to return a JSON object with a
results
array, each containing a
toolCallId
and a
result
.
Here’s the required format for both "Check Calendar Availability" and "Create Event":
Copy code
json
{
  "results": [
    {
      "toolCallId": "YOUR_TOOL_CALL_ID",
      "result": {
        "available": true,
        "timeSlots": [
          { "start": "2025-10-27T09:00:00", "end": "2025-10-27T10:00:00" }
        ],
        "message": "Perfect! The date is open. What time works for you?"
      }
    }
  ]
}
Replace
YOUR_TOOL_CALL_ID
with the ID from the incoming request.
This structure is required for Vapi to process your tool’s response correctly ([see docs](https://docs.vapi.ai/tools/custom-tools)). Source: - [Custom Tools](https://docs.vapi.ai/tools/custom-tools)
v
Message marked as helpful by @CryptoGamer! 🎉
2 Views