Skip to content

Variable: MastraThreadSchema

const MastraThreadSchema: ZodObject<{ createdAt: ZodString; id: ZodString; metadata: ZodOptional<ZodUnknown>; resourceId: ZodString; title: ZodOptional<ZodString>; updatedAt: ZodString; }, $strip>

A single conversation thread the resource (authenticated user) owns, as returned by GET ${basePath}/threads. Mirrors Mastra’s StorageThreadType but with JSON-safe ISO-8601 timestamps (the wire can’t carry Date).

Fields:

  • id: thread id. Pass it back as the thread-selection header (THREAD_ID_HEADER) on a stream / history / delete call to act on this conversation.
  • title: human-readable title. Present once the agent’s memory has auto-generated one (after the first turn); absent on a brand-new thread, so the UI falls back to a placeholder.
  • resourceId: owning resource (the user id). Always the caller’s own resource - the list route filters by it server-side.
  • createdAt / updatedAt: ISO-8601 timestamps. updatedAt is the natural sort key for “most recent conversations first”.
  • metadata: opaque thread metadata, passed through untouched.