Skip to content

docs: make the complete tool configuration template a valid payload - #1210

Merged
stephenvapiai merged 3 commits into
VapiAI:mainfrom
chiranjeet-vapi:docs/fix-complete-tool-config-template
Sep 10, 2026
Merged

docs: make the complete tool configuration template a valid payload#1210
stephenvapiai merged 3 commits into
VapiAI:mainfrom
chiranjeet-vapi:docs/fix-complete-tool-config-template

Conversation

@chiranjeet-vapi

Copy link
Copy Markdown
Contributor

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, strict and async all flat on the tool, with no type and no function wrapper.

Reproduced

POST https://api.vapi.ai/assistant, 2026-09-10, pasting the template as a tool:

model.each value in tools.type must be one of the following values: dtmf, endCall,
transferCall, ... function, mcp, apiRequest, ...

Add type and it fails again on the missing wrapper:

model.each value in tools.property name should not exist

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, parameters and strict go inside function. type, async and server sit on the tool.

server is 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 async inside the function object. That is wrong in the same way, but it does not 400. The API accepts async there and ignores it, since async is 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

chiranjeet-vapi and others added 2 commits September 10, 2026 03:08
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-app

lightsage-app Bot commented Sep 10, 2026

Copy link
Copy Markdown

Lightsage docs evals

Result: passed
Staging docs: https://api.vapi.ai/api-json`
Commit: e934974

Average score: 100/100
Passed: 3/3

Eval ID Status Score Model Tools Docs 404
08e24c18-82a0-45de-abdc-d237bd12bc0f Pass 100 claude-code/global.anthropic.claude... 8 0
08e24c18-82a0-45de-abdc-d237bd12bc0f Pass 100 cursor/auto 13 1
08e24c18-82a0-45de-abdc-d237bd12bc0f Pass 100 codex/gpt-5.4 36 1

@stephenvapiai

Copy link
Copy Markdown
Contributor

Three small follow-up edits an editorial pass turned up on this page. All apply cleanly on top of this PR's head (27b043f) and land in the same block, so they're easiest to fold in here.

  1. type + function wrapper on the "Enable schema validation" example. It was still flat (name/description/parameters/strict), the same shape this PR fixes for the complete template, so pasting it back hits model.each value in tools.property name should not exist. Wrapped it and moved the line highlight to strict.
  2. API-reference pointer + default wording. Linked model to the verified #request.body.model anchor (the same deep-link pattern the provider pages already use), and softened "defaults to 250" to "currently 250": api-json declares no default for maxTokens on any model schema, so the 5010000 range is spec-backed but 250 is a runtime value.
  3. Symptom card wording. "truncated Increase the model token limit" was a run-on; trimmed to just the symptom, since the card already links to the fix section.

Verified against https://api.vapi.ai/api-json: maxTokens is defined on model schemas only, and CreateFunctionToolDTO requires type: "function" plus a function wrapper.

Patch (applies on 27b043f):

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 limit

Tool call arguments are generated by the model, so they draw on the same
-per-turn token budget as speech. Raise maxTokens on the assistant's model,
-not on the tool. It accepts a value from 50 to 10000 and defaults to 250.
+per-turn token budget as speech. Raise maxTokens on the assistant's model,
+not on the tool. It accepts a value from 50 to 10000. When unset, the model
+applies its own default (currently 250).

`maxTokens` is a model property, not a tool property. Setting it inside ```

…ptom card

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@stephenvapiai
stephenvapiai self-requested a review September 10, 2026 21:45
@stephenvapiai
stephenvapiai merged commit c2c5a5b into VapiAI:main Sep 10, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants