Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
Class References
Function References
Interface References
Type Alias References
Variable References

normalizeToolResult

Function: normalizeToolResult()

ts
function normalizeToolResult(result): string | ContentPart[];
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[]