Skip to content

Commit 6438839

Browse files
authored
VAP-5420 Added tools message request (#291)
* VAP-5420 Added tools message request * added reference
1 parent b23e22f commit 6438839

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

fern/tools/custom-tools.mdx

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,79 @@ 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+
"toolCallList": [
105+
{
106+
"id": "toolu_01DTPAzUm5Gk3zxrpJ969oMF",
107+
"name": "get_weather",
108+
"arguments": {
109+
"location": "San Francisco"
110+
}
111+
}
112+
],
113+
"toolWithToolCallList": [
114+
{
115+
"type": "function",
116+
"name": "get_weather",
117+
"parameters": {
118+
"type": "object",
119+
"properties": {
120+
"location": {
121+
"type": "string"
122+
}
123+
}
124+
},
125+
"description": "Retrieves the current weather for a specified location"
126+
},
127+
"server": {
128+
"url": "https://your-api-server.com/weather"
129+
},
130+
"messages": [],
131+
"toolCall": {
132+
"id": "toolu_01DTPAzUm5Gk3zxrpJ969oMF",
133+
"type": "function",
134+
"function": {
135+
"name": "get_weather",
136+
"parameters": {
137+
"location": "San Francisco"
138+
}
139+
}
140+
}
141+
],
142+
"artifact": {
143+
"messages": []
144+
},
145+
"assistant": {
146+
"name": "Weather Assistant",
147+
"description": "An assistant that provides weather information",
148+
"model":{},
149+
"voice":{},
150+
"artifactPlans":{},
151+
"startSpeakingPlan":{}
152+
},
153+
"call": {
154+
"id": "call-uuid",
155+
"orgId": "org-uuid",
156+
"type": "webCall",
157+
"assistant": {}
158+
}
159+
}
160+
}
161+
```
162+
163+
<Note>
164+
For the complete API reference, see [ServerMessageToolCalls Type Definition](https://github.com/VapiAI/server-sdk-typescript/blob/main/src/api/types/ServerMessageToolCalls.ts#L7).
165+
</Note>
166+
167+
95168
## Server Response Format: Providing Results and Context
96169

97170
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)