Merge pull request #3 from modelcontextprotocol/sep-hostcontext-comment-fields

Move HostContext field descriptions to JSDoc comments
This commit is contained in:
Olivier Chafik 2025-11-23 03:32:08 +00:00 • committed by GitHub
commit 3ef1d3b227
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -331,27 +331,40 @@ When the Guest UI sends an `ui/initialize` request to the Host, the Host SHOULD
```typescript ```typescript
interface HostContext { interface HostContext {
toolInfo?: { // Metadata of the tool call that instantiated the App /** Metadata of the tool call that instantiated the App */
id?: RequestId, // JSON-RPC id of the tools/call request toolInfo?: {
tool: Tool, // contains name, inputSchema, etc… /** JSON-RPC id of the tools/call request */
id?: RequestId,
/** Contains name, inputSchema, etc… */
tool: Tool,
}; };
/** Current color theme preference */
theme?: "light" | "dark" | "system"; theme?: "light" | "dark" | "system";
/** How the UI is currently displayed */
displayMode?: "inline" | "fullscreen" | "pip" | "carousel"; displayMode?: "inline" | "fullscreen" | "pip" | "carousel";
/** Display modes the host supports */
availableDisplayModes?: string[]; availableDisplayModes?: string[];
/** Current and maximum dimensions available to the UI */
viewport?: { viewport?: {
width: number; width: number;
height: number; height: number;
maxHeight?: number; maxHeight?: number;
maxWidth?: number; maxWidth?: number;
}; };
locale?: string; // BCP 47, e.g., "en-US" /** User's language/region preference (BCP 47, e.g., "en-US") */
timeZone?: string; // IANA, e.g., "America/New_York" locale?: string;
/** User's timezone (IANA, e.g., "America/New_York") */
timeZone?: string;
/** Host application identifier */
userAgent?: string; userAgent?: string;
/** Platform type for responsive design */
platform?: "web" | "desktop" | "mobile"; platform?: "web" | "desktop" | "mobile";
/** Device capabilities such as touch */
deviceCapabilities?: { deviceCapabilities?: {
touch?: boolean; touch?: boolean;
hover?: boolean; hover?: boolean;
} }
/** Mobile safe area boundaries in pixels */
safeAreaInsets?: { safeAreaInsets?: {
top: number; top: number;
right: number; right: number;
@ -361,19 +374,6 @@ interface HostContext {
} }
``` ```
**Field Descriptions:**
- `theme`: Current color theme preference
- `displayMode`: How the UI is currently displayed
- `availableDisplayModes`: Display modes the host supports
- `viewport`: Current and maximum dimensions available to the UI
- `locale`: User's language/region preference
- `timeZone`: User's timezone
- `userAgent`: Host application identifier
- `platform`: Platform type for responsive design
- `deviceCapabilities`: Device capabilities such as touch
- `safeAreaInsets`: Mobile safe area boundaries in pixels
All fields are optional. Hosts SHOULD provide relevant context. Guest UIs SHOULD handle missing fields gracefully. All fields are optional. Hosts SHOULD provide relevant context. Guest UIs SHOULD handle missing fields gracefully.
Example: Example: