✓ PASS
vercel-ai 7.0.153
truncation.tool-call-args-stream · anthropic
Requirements
| Id | Level | Status | Evidence |
|---|---|---|---|
| no-complete-partial-call | MUST | SATISFIED | outcome=returned; error signalled |
| cause-is-truncation | MUST | SATISFIED | finish.value="length" (primary: fullStream.finish.finishReason); truth.finish="length"; error.category="validation"; structured.returned_as_success=false |
What the provider sent
- Finish
- length
- Raw finish
- max_tokens
- Text
null
- Tool calls
[ { "arguments": null, "arguments_parsed_ok": false, "arguments_raw": "{\"title\": \"Pottery in Málaga", "id": "toolu_01A09q90qw90lq917835lq9", "name": "create_event" } ]- Usage
{ "alternatives": {}, "cached_input": null, "input": 25, "output": 20, "raw": { "input_tokens": 25, "output_tokens": 20, "output_tokens_details": { "thinking_tokens": 6 } }, "reasoning": 6, "total": 45 }- Stream completed
true
- Error
null
Wire excerpt
status: 200
content-type: text/event-stream
body (sse):
event: message_start
data: {"type": "message_start", "message": {"id": "msg_01Aq9w938a90dw8q", "type": "message", "role": "assistant", "content": [], "model": "claude-sonnet-5-5", "stop_reason": null, "stop_sequence": null, "usage": {"input_tokens": 25, "output_tokens": 1}}}
event: content_block_start
data: {"type": "content_block_start", "index": 0, "content_block": {"type": "thinking", "thinking": "", "signature": ""}}
event: ping
data: {"type": "ping"}
event: content_block_delta
data: {"type": "content_block_delta", "index": 0, "delta": {"type": "thinking_delta", "thinking": ""}}
event: content_block_delta
data: {"type": "content_block_delta", "index": 0, "delta": {"type": "signature_delta", "signature": "EqQBCgIYAhIM1gbcDa9GJwZA2b3hGgxBdjrkzLoky3dl1pkiMOYds..."}}
event: content_block_stop
data: {"type": "content_block_stop", "index": 0}
event: content_block_start
data: {"type": "content_block_start", "index": 1, "content_block": {"type": "tool_use", "id": "toolu_01A09q90qw90lq917835lq9", "name": "create_event", "input": {}}}
event: content_block_delta
data: {"type": "content_block_delta", "index": 1, "delta": {"type": "input_json_delta", "partial_json": "{\"title\": \"Pot"}}
event: content_block_delta
data: {"type": "content_block_delta", "index": 1, "delta": {"type": "input_json_delta", "partial_json": "tery in Málaga"}}
event: content_block_stop
data: {"type": "content_block_stop", "index": 1}
event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"max_tokens","stop_sequence":null},"usage":{"output_tokens":20,"output_tokens_details":{"thinking_tokens":6}}}
event: message_stop
data: {"type": "message_stop"}
What the library reported
- Outcome
- returned
- Finish
{ "raw": "max_tokens", "source": "fullStream.finish.finishReason", "surface": "primary", "value": "length" }- Text
- Value
null
- Surface
- absent
- Tool calls
[ { "arguments": null, "arguments_parsed_ok": false, "arguments_raw": "{\"title\": \"Pottery in Málaga", "id": "toolu_01A09q90qw90lq917835lq9", "name": "create_event" } ]- Usage
{ "cached_input": 0, "input": 25, "output": 20, "reasoning": 6, "surface": { "cached_input": "primary", "input": "primary", "output": "primary", "reasoning": "primary", "total": "primary" }, "total": 45 }- Stream
{ "chunks_seen": 15, "completed": true, "used": true }- Error
- Type
- AI_InvalidToolInputError
- Message
- Invalid input for tool create_event: AI_JSONParseError: JSON parsing failed: Text: {"title": "Pottery in Málaga. Error message: SyntaxError: Unterminated string in JSON at position 28 (line 1 column 29)
- Category
- validation
- Retry after
null
- Stack top
- ai/dist/index.js:4223
- Unsupported reason
null
Full observation JSON
{
"elapsed_ms": 161.38183899999996,
"error": {
"category": "validation",
"message": "Invalid input for tool create_event: AI_JSONParseError: JSON parsing failed: Text: {\"title\": \"Pottery in Málaga.\nError message: SyntaxError: Unterminated string in JSON at position 28 (line 1 column 29)",
"retry_after": null,
"stack_top": "ai/dist/index.js:4223",
"type": "AI_InvalidToolInputError"
},
"finish": {
"raw": "max_tokens",
"source": "fullStream.finish.finishReason",
"surface": "primary",
"value": "length"
},
"format": "wiretruth.observation/v1",
"library": {
"api": "streamText",
"language": "javascript",
"name": "vercel-ai",
"version": "7.0.153"
},
"notes": [],
"outcome": "returned",
"stream": {
"chunks_seen": 15,
"completed": true,
"used": true
},
"structured": {
"attempted": false,
"returned_as_success": false,
"value": null
},
"text": {
"surface": "absent",
"value": null
},
"tool_calls": [
{
"arguments": null,
"arguments_parsed_ok": false,
"arguments_raw": "{\"title\": \"Pottery in Málaga",
"id": "toolu_01A09q90qw90lq917835lq9",
"name": "create_event"
}
],
"unsupported_reason": null,
"usage": {
"cached_input": 0,
"input": 25,
"output": 20,
"reasoning": 6,
"surface": {
"cached_input": "primary",
"input": "primary",
"output": "primary",
"reasoning": "primary",
"total": "primary"
},
"total": 45
}
}Fixture
documented anthropic/truncation.tool-call-args-stream
| Provenance | Value |
|---|---|
| Source | https://platform.claude.com/docs/en/agents-and-tools/tool-use/fine-grained-tool-streaming#handling-invalid-json-in-tool-responses |
| Notes | Documented shapes, not a recording. Message envelope and stop fields follow handling-stop-reasons; content blocks follow thinking/streaming and handle-tool-calls. Model changed to claude-sonnet-5-5; IDs and scenario text are filled in. Token counts are illustrative, filled in to include thinking within the requested output limit, not measured. eager_input_streaming and partial JSON at max_tokens are documented; the input fragments are original scenario text. ASSUMED composition with an omitted thinking block and a truncated tool block; the complete SSE transcript for this limit is not shown. The initial input: {} is only the documented placeholder, not the tool arguments. SSE names, JSON shapes, field order and spaced text/thinking events follow streaming examples; the compact message_delta follows Streaming request with tool use. Fragment boundaries and counts are filled in. Signature placeholder is copied literally from the signature_delta example; empty thinking_delta follows the documented omitted display flow. The output_tokens_details.thinking_tokens breakdown follows thinking-steering.md (https://platform.claude.com/docs/en/build-with-claude/thinking-steering-and-cost#pricing); the thinking count of 6 is filled in, not measured. It appears only in the final message_delta usage. |
Reproduce
wiretruth serve anthropic/truncation.tool-call-args-streamPlain-library snippet from the shim manifest.
createAnthropic({ baseURL: WIRETRUTH_BASE_URL_ANTHROPIC + '/v1', apiKey })(model)Upstream
No matching upstream report.
History
| Version | Grade |
|---|---|
| 7.0.153 | ✓ PASS |
| 7.0.146 | ✓ PASS |
| 7.0.142 | ✓ PASS |