Skip to content

Variable: MastraHistoryResponseSchema

const MastraHistoryResponseSchema: ZodObject<{ hasMore: ZodBoolean; page: ZodNumber; perPage: ZodNumber; total: ZodNumber; uiMessages: ZodArray<ZodObject<{ id: ZodString; metadata: ZodOptional<ZodUnknown>; parts: ZodReadonly<ZodArray<ZodUnknown>>; role: ZodEnum<{ assistant: "assistant"; system: "system"; user: "user"; }>; }, $strip>>; }, $strip>

JSON payload returned by GET ${basePath}/route/history.

Fields:

  • uiMessages: page of UI-formatted messages, oldest -> newest. Always chronological regardless of the underlying pagination order so the client can prepend the array to the live transcript without sorting.
  • page: zero-indexed page that produced this response.
  • perPage: number of items requested per page.
  • total: total number of messages in the thread.
  • hasMore: true when at least one older page is still available.