Merge pull request #152 from modelcontextprotocol/martinalong/mcp-apps/display-mode-updates

[MCP Apps] Have apps request display mode instead
This commit is contained in:
martinalong 2025-12-15 16:12:45 -08:00 • committed by GitHub
commit c516cf0894
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -677,6 +677,39 @@ Host behavior:
* Host SHOULD add the message to the conversation context, preserving the specified role.
* Host MAY request user consent.
`ui/request-display-mode` - Request host to change display mode
```typescript
// Request
{
jsonrpc: "2.0",
id: 3,
method: "ui/request-display-mode",
params: {
mode: "inline" | "fullscreen" | "pip" // Requested display mode
}
}
// Success Response
{
jsonrpc: "2.0",
id: 3,
result: {
mode: "inline" | "fullscreen" | "pip" // Actual display mode set
}
}
```
Host behavior:
* App MUST check if the requested mode is in `availableDisplayModes` from host context.
* 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.
* If the requested mode is not available, Host SHOULD return the current display mode in the response.
* Host MAY coerce modes on certain platforms (e.g., "pip" to "fullscreen" on mobile).
Guest UI behavior:
* Guest UI SHOULD check `availableDisplayModes` in host context before requesting a mode change.
* Guest UI MUST handle the response mode differing from the requested mode.
#### Notifications (Host → UI)
`ui/notifications/tool-input` - Host MUST send this notification with the complete tool arguments after the Guest UI's initialize request completes.