docs: make the complete tool configuration template a valid payload - #1210
Conversation
The custom tools troubleshooting page told readers to set maxTokens on a tool, in three code blocks and in the debugging table. The API has no such field, so pasting the page's own example back returns 400: POST https://api.vapi.ai/assistant {"message":["model.each value in tools.function.property maxTokens should not exist"],"error":"Bad Request","statusCode":400} Reproduced 2026-09-10. A report of this arrives with an assistant.model prefix when the payload is nested under an assistant key; a direct POST roots at model. Same validator. Per https://api.vapi.ai/api-json, OpenAIFunction accepts only name, strict, description and parameters, and JsonSchema, used for each property, accepts only type, items, properties, description, pattern, format, required, enum and title. maxTokens is defined on the model schemas alone, with a range of 50 to 10000 and a default of 250, so the token truncation section now points at model.maxTokens and states the real default. The page previously said the default was 100, which is not a value the API has anywhere. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The "Complete tool configuration" template on the custom tools troubleshooting page is not a payload the API accepts. Pasted as a tool it returns 400 twice over, reproduced against POST https://api.vapi.ai/assistant on 2026-09-10: as written model.each value in tools.type must be one of the following values: dtmf, endCall, ... function, mcp, apiRequest, ... with type added, function wrapper still missing model.each value in tools.property name should not exist name, description, parameters and strict belong inside function; type, async and server sit on the tool. The template had them all flat, so it was missing both the discriminator and the wrapper. The corrected template validates: posted with a deliberate unrelated error to force rejection, the tool itself produces no validation failure. server is optional and is included because a custom tool without one has nowhere to send its tool-calls webhook, which is the subject of this page. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Lightsage docs evalsResult: passed Average score: 100/100
|
|
Three small follow-up edits an editorial pass turned up on this page. All apply cleanly on top of this PR's head (
Verified against Patch (applies on diff --git a/fern/tools/custom-tools-troubleshooting.mdx b/fern/tools/custom-tools-troubleshooting.mdx
index 3d1b978..a610b30 100644
--- a/fern/tools/custom-tools-troubleshooting.mdx
+++ b/fern/tools/custom-tools-troubleshooting.mdx
@@ -31,8 +31,7 @@ Start with the most common issue for your symptoms:
format problems
</Card>
<Card title="Parameters cut off" href="#token-truncation">
- **Symptoms:** Tool parameters or responses truncated Increase the model
- token limit
+ **Symptoms:** Tool parameters or responses are truncated.
</Card>
</CardGroup>
@@ -77,14 +76,17 @@ Check that your tool schema includes all required parameters:
Add `strict: true` to catch validation errors early:
-```json title="Tool configuration" {7}
+```json title="Tool configuration" {9}
{
- "name": "get_weather",
- "description": "Get current weather for a city",
- "parameters": {
- // ... your parameters
- },
- "strict": true
+ "type": "function",
+ "function": {
+ "name": "get_weather",
+ "description": "Get current weather for a city",
+ "parameters": {
+ // ... your parameters
+ },
+ "strict": true
+ }
}@@ -228,8 +230,9 @@ Tool parameters or responses are getting cut off. Increase the model token limitTool call arguments are generated by the model, so they draw on the same |
…ptom card Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Stacked on #1209, which touches the same code block. Merge that one first; this diff shrinks to a single block once it lands.
Problem
The "Complete tool configuration" template on the custom tools troubleshooting page is not a payload the API accepts. It has
name,description,parameters,strictandasyncall flat on the tool, with notypeand nofunctionwrapper.Reproduced
POST https://api.vapi.ai/assistant, 2026-09-10, pasting the template as a tool:Add
typeand it fails again on the missing wrapper:The corrected template validates. Posted with a deliberate unrelated error to force rejection, the tool itself produces no validation failure, only the unrelated one.
What changed
One code block, plus a line naming which fields sit where.
name,description,parametersandstrictgo insidefunction.type,asyncandserversit on the tool.serveris optional, confirmed: a correctly nested tool without one returns no error. It is included because a custom tool without a server has nowhere to send its tool-calls webhook, which is what this page is about.Not in this PR
The "Async vs sync behavior" tabs show
asyncinside the function object. That is wrong in the same way, but it does not 400. The API acceptsasyncthere and ignores it, sinceasyncis read at tool level, so it is a silently-inert example rather than a broken one. Left alone here; happy to fix it if wanted.🤖 Generated with Claude Code