Skip to content

Variable: MastraClearHistoryResponseSchema

const MastraClearHistoryResponseSchema: ZodObject<{ agentId: ZodString; cleared: ZodNumber; ok: ZodLiteral<true>; threadId: ZodString; }, $strip>

JSON payload returned by DELETE ${basePath}/route/history. Deletes every persisted message + workflow snapshot tied to the caller’s thread, so the next chat turn starts from a clean slate. The session cookie that anchors the thread id is preserved so the caller doesn’t lose its identity - only the contents go away.

ok is always true on success; the response object is kept as a struct (vs a bare 204) so future fields (e.g. deletedAt, messages) can be added without bumping the contract.

Fields:

  • ok: literal true on success.
  • agentId: agent whose history was cleared.
  • threadId: thread id that was wiped.
  • cleared: number of messages the thread held before deletion. Useful for client-side “cleared 12 messages” toasts; 0 is reported when the thread was already empty (call is idempotent).