Skip to content

Commit 20e29da

Browse files
martinalongclaude
andcommitted
Create unified Display Modes section
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>
1 parent 8e5b641 commit 20e29da

1 file changed

Lines changed: 58 additions & 11 deletions

File tree

specification/draft/apps.mdx

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,63 @@ bridge.onsizechange = ({ width, height }) => {
730730

731731
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.
732732

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+
type McpUiDisplayMode = "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
743+
- **pip**: Picture-in-picture, floating overlay
744+
745+
#### Declaring Support
746+
747+
**View (`appCapabilities.availableDisplayModes`):**
748+
749+
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+
733790
### Theming
734791

735792
Hosts can optionally pass CSS custom properties via `HostContext.styles.variables` for visual cohesion with the host environment.
@@ -998,17 +1055,7 @@ Host behavior:
9981055
}
9991056
```
10001057

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.
10121059

10131060
`ui/update-model-context` - Update the model context
10141061

0 commit comments

Comments
 (0)