TanStack

normalizeToolResult

Function: normalizeToolResult()

ts
function normalizeToolResult(result): string | ContentPart[];

Defined in: packages/ai/src/utilities/tool-result.ts:54

Normalize a tool's return value for transport:

  • string → unchanged
  • ContentPart array → unchanged (multimodal, passed through to the adapter)
  • anything else → JSON.stringify

Parameters

result

unknown

Returns

string | ContentPart[]