Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

normalizeToolResult.md

25 lines503 Bytes

1---
2id: normalizeToolResult
3title: normalizeToolResult
4---
5​
6```ts
7function normalizeToolResult(result): string | ContentPart[];
8```
9​
10Defined in: packages/ai/src/utilities/tool-result.ts:96
11​
12Normalize a tool's return value for transport:
13- string → unchanged
14- ContentPart array → unchanged (multimodal, passed through to the adapter)
15- anything else → `JSON.stringify`
16​
17## Parameters
18​
19### result
20​
21`unknown`
22​
23## Returns
24​
25`string` \| [`ContentPart`](../type-aliases/ContentPart.md)[]