Skip to content

Commit 774e9e1

Browse files
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 <[email protected]>
1 parent 3fe9cde commit 774e9e1

File tree

1 file changed

+53
-53
lines changed

1 file changed

+53
-53
lines changed

specification/draft/apps.mdx

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,12 @@ Host SHOULD add the message to the conversation thread, preserving the specified
476476

477477
`ui/notifications/tool-input` - Host MUST send this notification with the complete tool arguments after the Guest UI's initialize request completes.
478478

479-
```json
479+
```typescript
480480
{
481-
"jsonrpc": "2.0",
482-
"method": "ui/notifications/tool-input",
483-
"params": {
484-
"arguments": "Record<string, unknown>" // Tool input arguments
481+
jsonrpc: "2.0",
482+
method: "ui/notifications/tool-input",
483+
params: {
484+
arguments: Record<string, unknown> // Tool input arguments
485485
}
486486
}
487487
```
@@ -490,12 +490,12 @@ Host sends this notification after the Guest UI's initialize request completes,
490490

491491
`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.
492492

493-
```json
493+
```typescript
494494
{
495-
"jsonrpc": "2.0",
496-
"method": "ui/notifications/tool-input-partial",
497-
"params": {
498-
"arguments": "Record<string, unknown>" // Tool input arguments
495+
jsonrpc: "2.0",
496+
method: "ui/notifications/tool-input-partial",
497+
params: {
498+
arguments: Record<string, unknown> // Tool input arguments
499499
}
500500
}
501501
```
@@ -515,24 +515,24 @@ Guest UI behavior (optional):
515515

516516
`ui/notifications/tool-result` - Tool execution result
517517

518-
```json
518+
```typescript
519519
{
520-
"jsonrpc": "2.0",
521-
"method": "ui/notifications/tool-result",
522-
"params": "CallToolResult" // Standard MCP type
520+
jsonrpc: "2.0",
521+
method: "ui/notifications/tool-result",
522+
params: CallToolResult // Standard MCP type
523523
}
524524
```
525525

526526
Host MUST send this notification when tool execution completes (if UI is displayed during tool execution).
527527

528528
`ui/tool-cancelled` - Tool execution was cancelled
529529

530-
```json
530+
```typescript
531531
{
532-
"jsonrpc": "2.0",
533-
"method": "ui/tool-cancelled",
534-
"params": {
535-
"reason": "string"
532+
jsonrpc: "2.0",
533+
method: "ui/tool-cancelled",
534+
params: {
535+
reason: string
536536
}
537537
}
538538
```
@@ -541,30 +541,30 @@ Host MUST send this notification if the tool execution was cancelled, for any re
541541

542542
`ui/resource-teardown` - Host notifies UI before teardown
543543

544-
```json
544+
```typescript
545545
{
546-
"jsonrpc": "2.0",
547-
"id": 1,
548-
"method": "ui/resource-teardown",
549-
"params": {
550-
"reason": "string"
546+
jsonrpc: "2.0",
547+
id: 1,
548+
method: "ui/resource-teardown",
549+
params: {
550+
reason: string
551551
}
552552
}
553553

554554
// Success Response
555555
{
556-
"jsonrpc": "2.0",
557-
"id": 1,
558-
"result": {} // Empty result on success
556+
jsonrpc: "2.0",
557+
id: 1,
558+
result: {} // Empty result on success
559559
}
560560

561561
// Error Response (if failed)
562562
{
563-
"jsonrpc": "2.0",
564-
"id": 1,
565-
"error": {
566-
"code": -32000, // Implementation-defined error
567-
"message": "Teardown error"
563+
jsonrpc: "2.0",
564+
id: 1,
565+
error: {
566+
code: -32000, // Implementation-defined error
567+
message: "Teardown error"
568568
}
569569
}
570570
```
@@ -574,13 +574,13 @@ Host SHOULD wait for a response before tearing down the resource (to prevent dat
574574

575575
`ui/size-change` - UI’s size changed
576576

577-
```json
577+
```typescript
578578
{
579-
"jsonrpc": "2.0",
580-
"method": "ui/size-change",
581-
"params": {
582-
"width": "number", // Viewport width in pixels
583-
"height": "number" // Viewport height in pixels
579+
jsonrpc: "2.0",
580+
method: "ui/size-change",
581+
params: {
582+
width: number, // Viewport width in pixels
583+
height: number // Viewport height in pixels
584584
}
585585
}
586586
```
@@ -589,11 +589,11 @@ Guest UI SHOULD send this notification when rendered content body size changes (
589589

590590
`ui/host-context-change` - Host context has changed
591591

592-
```json
592+
```typescript
593593
{
594-
"jsonrpc": "2.0",
595-
"method": "ui/host-context-change",
596-
"params": "Partial<HostContext>" // See HostContext type above
594+
jsonrpc: "2.0",
595+
method: "ui/host-context-change",
596+
params: Partial<HostContext> // See HostContext type above
597597
}
598598
```
599599

@@ -605,23 +605,23 @@ These messages are reserved for web-based hosts that implement the recommended d
605605

606606
`ui/notifications/sandbox-ready` (Sandbox Proxy → Host) - Sandbox proxy is ready
607607

608-
```json
608+
```typescript
609609
{
610-
"jsonrpc": "2.0",
611-
"method": "ui/notifications/sandbox-ready",
612-
"params": {}
610+
jsonrpc: "2.0",
611+
method: "ui/notifications/sandbox-ready",
612+
params: {}
613613
}
614614
```
615615

616616
`ui/notifications/sandbox-resource-ready` (Host → Sandbox Proxy) - HTML resource ready to load
617617

618-
```json
618+
```typescript
619619
{
620-
"jsonrpc": "2.0",
621-
"method": "ui/notifications/sandbox-resource-ready",
622-
"params": {
623-
"html": "string", // HTML content to load
624-
"sandbox": "string" // Optional override for inner iframe `sandbox` attribute
620+
jsonrpc: "2.0",
621+
method: "ui/notifications/sandbox-resource-ready",
622+
params: {
623+
html: string, // HTML content to load
624+
sandbox: string // Optional override for inner iframe `sandbox` attribute
625625
}
626626
}
627627
```

0 commit comments

Comments
 (0)