You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consolidate all display mode documentation into a single section:
- Display mode types (inline, fullscreen, pip)
- Declaring support from View (appCapabilities.availableDisplayModes)
- Declaring support from Host (HostContext.availableDisplayModes)
- Requesting changes (ui/request-display-mode)
- Notifying changes (ui/notifications/host-context-changed)
- All MUST/SHOULD requirements for View and Host behavior
The ui/request-display-mode in Requests section now references
the Display Modes section for behavior details.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Apps using the SDK automatically send size-changed notifications via ResizeObserver when `autoResize` is enabled (the default). The notifications are debounced and only sent when dimensions actually change.
732
732
733
+
### Display Modes
734
+
735
+
Views can be displayed in different modes depending on the host's capabilities and the view's declared support.
736
+
737
+
```typescript
738
+
typeMcpUiDisplayMode="inline"|"fullscreen"|"pip";
739
+
```
740
+
741
+
-**inline**: Default mode, embedded within the host's content flow
742
+
-**fullscreen**: View takes over the full screen/window
Views declare which display modes they support in the `ui/initialize` request via `appCapabilities.availableDisplayModes`. This allows hosts to only offer display mode options that the view can handle.
750
+
751
+
```typescript
752
+
// Example: View declares support for inline and fullscreen
753
+
{
754
+
method: "ui/initialize",
755
+
params: {
756
+
appCapabilities: {
757
+
availableDisplayModes: ["inline", "fullscreen"]
758
+
},
759
+
// ...
760
+
}
761
+
}
762
+
```
763
+
764
+
**Host (`HostContext.availableDisplayModes`):**
765
+
766
+
Hosts declare which display modes they support in `HostContext.availableDisplayModes`. Views should check this before requesting a mode change.
767
+
768
+
#### Requesting Changes
769
+
770
+
Views request display mode changes via `ui/request-display-mode`. See the Requests section for message format.
771
+
772
+
#### Notifying Changes
773
+
774
+
Hosts notify views of display mode changes via `ui/notifications/host-context-changed` with the `displayMode` field.
775
+
776
+
#### Requirements
777
+
778
+
**View behavior:**
779
+
- View MUST declare all display modes it supports in `appCapabilities.availableDisplayModes` during initialization.
780
+
- View MUST check if the requested mode is in `availableDisplayModes` from host context before requesting a mode change.
781
+
- View MUST handle the response mode differing from the requested mode.
782
+
783
+
**Host behavior:**
784
+
- Host MUST NOT switch the View to a display mode that does not appear in its `appCapabilities.availableDisplayModes`, if set.
785
+
- Host MUST return the resulting mode (whether updated or not) in the response to `ui/request-display-mode`.
786
+
- If the requested mode is not available, Host SHOULD return the current display mode in the response.
787
+
- Host MAY coerce modes on certain platforms (e.g., "pip" to "fullscreen" on mobile).
788
+
- Host MAY decline display mode requests from Views that did not declare said modes in their capabilities.
789
+
733
790
### Theming
734
791
735
792
Hosts can optionally pass CSS custom properties via `HostContext.styles.variables` for visual cohesion with the host environment.
@@ -998,17 +1055,7 @@ Host behavior:
998
1055
}
999
1056
```
1000
1057
1001
-
Host behavior:
1002
-
* Host MUST NOT switch the View to a display mode that does not appear in its `appCapabilities.availableDisplayModes`, if set.
1003
-
* It is up to the host whether it switches to the requested mode, but the host MUST return the resulting mode (whether updated or not) in the response.
1004
-
* If the requested mode is not available, Host SHOULD return the current display mode in the response.
1005
-
* Host MAY coerce modes on certain platforms (e.g., "pip" to "fullscreen" on mobile).
1006
-
* Host MAY decline display mode requests from Views that did not declare said modes in their capabilities.
1007
-
1008
-
View behavior:
1009
-
* View MUST declare all display modes it supports in `appCapabilities.availableDisplayModes` during initialization.
1010
-
* View MUST check if the requested mode is in `availableDisplayModes` from host context before requesting a mode change.
1011
-
* View MUST handle the response mode differing from the requested mode.
1058
+
See the Display Modes section for detailed behavior requirements.
1012
1059
1013
1060
`ui/update-model-context` - Update the model context
0 commit comments