Skip to content

Commit 13fa708

Browse files
committed
VAP-5420 Added tools message request
1 parent b23e22f commit 13fa708

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

fern/tools/custom-tools.mdx

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,83 @@ Let's say you want to create a tool that fetches the weather for a given locatio
9292

9393
Simply create additional tool objects within the "tools" array, following the same structure and modifying the details as needed. Each tool can have its own unique configuration and messages.
9494

95+
## Request Format: Understanding the Tool Call Request
96+
97+
When your server receives a tool call request from Vapi, it will be in the following format:
98+
99+
```json
100+
{
101+
"message": {
102+
"timestamp": 1678901234567,
103+
"type": "tool-calls",
104+
"toolCalls": [
105+
{
106+
"id": "toolu_01DTPAzUm5Gk3zxrpJ969oMF",
107+
"name": "get_weather",
108+
"arguments": {
109+
"location": "San Francisco"
110+
}
111+
}
112+
],
113+
"toolCallList": [
114+
{
115+
"id": "toolu_01DTPAzUm5Gk3zxrpJ969oMF",
116+
"name": "get_weather",
117+
"arguments": {
118+
"location": "San Francisco"
119+
}
120+
}
121+
],
122+
"toolWithToolCallList": [
123+
{
124+
"type": "function",
125+
"name": "get_weather",
126+
"parameters": {
127+
"type": "object",
128+
"properties": {
129+
"location": {
130+
"type": "string"
131+
}
132+
}
133+
},
134+
"description": "Retrieves the current weather for a specified location"
135+
},
136+
"server": {
137+
"url": "https://your-api-server.com/weather"
138+
},
139+
"messages": [],
140+
"toolCall": {
141+
"id": "toolu_01DTPAzUm5Gk3zxrpJ969oMF",
142+
"type": "function",
143+
"function": {
144+
"name": "get_weather",
145+
"parameters": {
146+
"location": "San Francisco"
147+
}
148+
}
149+
}
150+
],
151+
"artifact": {
152+
"messages": []
153+
},
154+
"assistant": {
155+
"name": "Weather Assistant",
156+
"description": "An assistant that provides weather information",
157+
"model":{},
158+
"voice":{},
159+
"artifactPlans":{},
160+
"startSpeakingPlan":{}
161+
},
162+
"call": {
163+
"id": "call-uuid",
164+
"orgId": "org-uuid",
165+
"type": "webCall",
166+
"assistant": {}
167+
}
168+
}
169+
}
170+
```
171+
95172
## Server Response Format: Providing Results and Context
96173

97174
When your Vapi assistant calls a tool (via the server URL you configured), your server will receive an HTTP request containing information about the tool call. Upon processing the request and executing the desired function, your server needs to send back a response in the following JSON format:

0 commit comments

Comments
 (0)