Overview
sendSizeChanged manually notifies the host that the View’s dimensions have changed. The host uses this information to resize the iframe containing the MCP App.
In most cases, you do not need to call this method directly. The App class enables auto-resize by default, which automatically detects DOM changes and sends size updates to the host. Use sendSizeChanged only when you need explicit control over sizing — for example, after an animation completes, when rendering canvas-based content, or when auto-resize is disabled.
Signature
Parameters
Returns
ReturnsPromise<void>. The method resolves when the size notification has been sent to the host.
Usage
Setting explicit dimensions
Updating only the height
After an animation or transition
With canvas-based content
When
autoResize is enabled (the default), calling sendSizeChanged is unnecessary for standard DOM changes. The auto-resize observer handles this automatically. Disable auto-resize only when you need precise manual control over reported dimensions.Related
- Auto-Resize — How automatic size detection works in the
Appclass. useAutoResize— React hook for auto-resize behavior.- Requests — Overview of all View-to-host request methods.