Anthropic Messages API truncates tools array

Anthropic Messages API truncates tools array

Today a Claude 3 call with tool definitions started ignoring the last tool in the list. No errors, just missing.

Payload contained eight tool specs. Each one about 5 k‑char JSON. The docs mention a 64 k request cap; combined tools plus prompt was ~66 k.

Fixed by:

  • switching to POST /v1/messages?max_tokens=0 first to check size
  • slimming descriptions to 1‑2 sentences
  • removing unused parameters

After shrinking to 60 k total the last tool returned in required_tool_calls.

If you need more tools use tool_choice="auto" and supply only relevant tools per request instead of the full catalogue.

comments powered by Disqus