Prompt Buddy logoPrompt Buddy

vercel · Vercel AI SDK Docs

AI SDK UI: Message Metadata

Explains how to attach and access custom metadata objects within AI SDK UI message objects to extend the data structure of chat messages.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

AI SDK UI: Message Metadata

Explains how to attach and access custom metadata objects within AI SDK UI message objects to extend the data structure of chat messages.

When To Use

Use when you need to attach additional properties or context to individual messages in a chat interface beyond the standard role and content fields.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/ai-sdk-ui-message-metadata-workflow-guide.mdA guide explaining how to attach and use custom metadata within AI SDK UI messages for tracking information like timestamps and token usage.Questions about a guide explaining how to attach and use custom metadata within AI SDK UI messages for tracking information like time...
examples/ai-sdk-ui-message-metadata-typescript.textA TypeScript code example demonstrating how to define a Zod schema for UIMessage metadata and type it for use with the AI SDK UI.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to define a Zod schema for UIMessage metadata and type it for use with th...
examples/ai-sdk-ui-message-metadata-typescript-2.textA TypeScript code example demonstrating how to use custom metadata within AI SDK UI messages by converting them to model messages.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to use custom metadata within AI SDK UI messages by converting them to mo...
examples/ai-sdk-ui-message-metadata-react-usechat.textA React client component demonstrating how to implement and access custom metadata within the useChat hook from the AI SDK UI.Exact payloads, commands, or snippets shown in A React client component demonstrating how to implement and access custom metadata within the useChat hook from the A...

What This Skill Covers

  • Message metadata allows you to attach custom information to messages at the message level. This is useful for tracking timestamps, model information, token u...
  • Main sections: Overview, Getting Started, Defining Metadata Types, Sending Metadata from the Server, Accessing Metadata on the Client.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://ai-sdk.dev/docs/ai-sdk-ui/message-metadata