Convert notification examples from JSON to TypeScript format

Changes code blocks for notification examples to use `typescript` fence
instead of `json`. This properly represents TypeScript types (like
Record<string, unknown>, CallToolResult, Partial<HostContext>) without
quotes, matching the format used elsewhere in the specification.

Affected notifications:

- ui/notifications/tool-input
- ui/notifications/tool-input-partial
- ui/notifications/tool-result
- ui/tool-cancelled
- ui/resource-teardown
- ui/size-change
- ui/host-context-change
- ui/notifications/sandbox-ready
- ui/notifications/sandbox-resource-ready

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jonathan Hefner 2025-11-21 15:32:31 -06:00
commit 06c37b045b

View file

@ -476,12 +476,12 @@ Host SHOULD add the message to the conversation thread, preserving the specified
`ui/notifications/tool-input` - Host MUST send this notification with the complete tool arguments after the Guest UI's initialize request completes. `ui/notifications/tool-input` - Host MUST send this notification with the complete tool arguments after the Guest UI's initialize request completes.
```json ```typescript
{ {
"jsonrpc": "2.0", jsonrpc: "2.0",
"method": "ui/notifications/tool-input", method: "ui/notifications/tool-input",
"params": { params: {
"arguments": "Record<string, unknown>" // Tool input arguments arguments: Record<string, unknown> // Tool input arguments
} }
} }
``` ```
@ -490,12 +490,12 @@ Host sends this notification after the Guest UI's initialize request completes,
`ui/notifications/tool-input-partial` - Host MAY send this notification zero or more times while the agent is streaming tool arguments, before `ui/notifications/tool-input` is sent. `ui/notifications/tool-input-partial` - Host MAY send this notification zero or more times while the agent is streaming tool arguments, before `ui/notifications/tool-input` is sent.
```json ```typescript
{ {
"jsonrpc": "2.0", jsonrpc: "2.0",
"method": "ui/notifications/tool-input-partial", method: "ui/notifications/tool-input-partial",
"params": { params: {
"arguments": "Record<string, unknown>" // Tool input arguments arguments: Record<string, unknown> // Tool input arguments
} }
} }
``` ```
@ -515,11 +515,11 @@ Guest UI behavior (optional):
`ui/notifications/tool-result` - Tool execution result `ui/notifications/tool-result` - Tool execution result
```json ```typescript
{ {
"jsonrpc": "2.0", jsonrpc: "2.0",
"method": "ui/notifications/tool-result", method: "ui/notifications/tool-result",
"params": "CallToolResult" // Standard MCP type params: CallToolResult // Standard MCP type
} }
``` ```
@ -527,12 +527,12 @@ Host MUST send this notification when tool execution completes (if UI is display
`ui/tool-cancelled` - Tool execution was cancelled `ui/tool-cancelled` - Tool execution was cancelled
```json ```typescript
{ {
"jsonrpc": "2.0", jsonrpc: "2.0",
"method": "ui/tool-cancelled", method: "ui/tool-cancelled",
"params": { params: {
"reason": "string" reason: string
} }
} }
``` ```
@ -541,30 +541,30 @@ Host MUST send this notification if the tool execution was cancelled, for any re
`ui/resource-teardown` - Host notifies UI before teardown `ui/resource-teardown` - Host notifies UI before teardown
```json ```typescript
{ {
"jsonrpc": "2.0", jsonrpc: "2.0",
"id": 1, id: 1,
"method": "ui/resource-teardown", method: "ui/resource-teardown",
"params": { params: {
"reason": "string" reason: string
} }
} }
// Success Response // Success Response
{ {
"jsonrpc": "2.0", jsonrpc: "2.0",
"id": 1, id: 1,
"result": {} // Empty result on success result: {} // Empty result on success
} }
// Error Response (if failed) // Error Response (if failed)
{ {
"jsonrpc": "2.0", jsonrpc: "2.0",
"id": 1, id: 1,
"error": { error: {
"code": -32000, // Implementation-defined error code: -32000, // Implementation-defined error
"message": "Teardown error" message: "Teardown error"
} }
} }
``` ```
@ -574,13 +574,13 @@ Host SHOULD wait for a response before tearing down the resource (to prevent dat
`ui/size-change` - UI’s size changed `ui/size-change` - UI’s size changed
```json ```typescript
{ {
"jsonrpc": "2.0", jsonrpc: "2.0",
"method": "ui/size-change", method: "ui/size-change",
"params": { params: {
"width": "number", // Viewport width in pixels width: number, // Viewport width in pixels
"height": "number" // Viewport height in pixels height: number // Viewport height in pixels
} }
} }
``` ```
@ -589,11 +589,11 @@ Guest UI SHOULD send this notification when rendered content body size changes (
`ui/host-context-change` - Host context has changed `ui/host-context-change` - Host context has changed
```json ```typescript
{ {
"jsonrpc": "2.0", jsonrpc: "2.0",
"method": "ui/host-context-change", method: "ui/host-context-change",
"params": "Partial<HostContext>" // See HostContext type above params: Partial<HostContext> // See HostContext type above
} }
``` ```
@ -605,23 +605,23 @@ These messages are reserved for web-based hosts that implement the recommended d
`ui/notifications/sandbox-ready` (Sandbox Proxy → Host) - Sandbox proxy is ready `ui/notifications/sandbox-ready` (Sandbox Proxy → Host) - Sandbox proxy is ready
```json ```typescript
{ {
"jsonrpc": "2.0", jsonrpc: "2.0",
"method": "ui/notifications/sandbox-ready", method: "ui/notifications/sandbox-ready",
"params": {} params: {}
} }
``` ```
`ui/notifications/sandbox-resource-ready` (Host → Sandbox Proxy) - HTML resource ready to load `ui/notifications/sandbox-resource-ready` (Host → Sandbox Proxy) - HTML resource ready to load
```json ```typescript
{ {
"jsonrpc": "2.0", jsonrpc: "2.0",
"method": "ui/notifications/sandbox-resource-ready", method: "ui/notifications/sandbox-resource-ready",
"params": { params: {
"html": "string", // HTML content to load html: string, // HTML content to load
"sandbox": "string" // Optional override for inner iframe `sandbox` attribute sandbox: string // Optional override for inner iframe `sandbox` attribute
} }
} }
``` ```