Skip to main content
sunpeak API

Overview

Registers a cleanup callback that runs before the app’s iframe is destroyed. Use this to save state, close connections, or perform other cleanup.

Wraps onteardown

MCP Apps SDK reference

Import

Signature

Parameters

callback
() => Promise<void> | void
required
Cleanup function to run before app destruction.

Returns

return
void
This hook does not return a value.

Usage