Overview
updateModelContext pushes app state into the host’s model context. This data becomes available to the model on future turns without triggering an immediate response — unlike sendMessage, which injects a message into the conversation and may prompt the model to reply.
Each call to updateModelContext overwrites any previously set context. To clear the context, call it with empty content.
This is useful for keeping the model informed about what the user is viewing or doing in the app, such as the current page, selected items, or filter state.
Signature
Parameters
The context update parameters. Provide at least one of
content or structuredContent.Array of content blocks (text, images, etc.) to set as the model context. The model can read these on subsequent turns.
Structured data to set as the model context. Useful for passing typed objects, configuration, or state that the model can reference.
Optional request configuration.
An
AbortSignal to cancel the request.Returns
Resolves withvoid on success. Throws on transport or protocol failure.
Usage
Set text context
Set structured context
Clear previous context
Related
- Requests overview — all available View-to-host request methods
useUpdateModelContext— sunpeak React convenience hook- sendMessage — send a message that appears in the conversation