Skip to content

Commit cd24050

Browse files
Complete JSON-RPC message examples in Data Passing section
The tool input and tool result examples now show fully formed JSON-RPC messages with all required fields (jsonrpc, id/method, result/params) to better demonstrate the protocol format. Also fixes MDX parsing error in Client\<>Server heading by escaping angle brackets. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 5a5bd84 commit cd24050

File tree

1 file changed

+56
-25
lines changed

1 file changed

+56
-25
lines changed

specification/draft/apps.mdx

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -751,13 +751,28 @@ Tool execution results are passed to the UI through two mechanisms:
751751
The original tool call arguments:
752752

753753
```typescript
754-
// Tool was called with:
755-
tools/call("get_weather", { location: "San Francisco" })
754+
// Tool was called with (JSON-RPC request from Host to Server):
755+
{
756+
jsonrpc: "2.0",
757+
id: 1,
758+
method: "tools/call",
759+
params: {
760+
name: "get_weather",
761+
arguments: {
762+
location: "San Francisco"
763+
}
764+
}
765+
}
756766

757-
// UI receives:
758-
notification: ui/notifications/tool-input
759-
params: {
760-
arguments: { location: "San Francisco" }
767+
// UI receives (JSON-RPC notification from Host to UI):
768+
{
769+
jsonrpc: "2.0",
770+
method: "ui/notifications/tool-input",
771+
params: {
772+
arguments: {
773+
location: "San Francisco"
774+
}
775+
}
761776
}
762777
```
763778

@@ -766,28 +781,44 @@ params: {
766781
The tool's execution result:
767782

768783
```typescript
769-
// Server returns from tool execution:
784+
// Server returns from tool execution (JSON-RPC response):
770785
{
771-
content: [
772-
{ type: "text", text: "Current weather: Sunny, 72°F" }
773-
],
774-
structuredContent: {
775-
temperature: 72,
776-
conditions: "sunny",
777-
humidity: 45
778-
},
779-
_meta: {
780-
timestamp: "2025-11-10T15:30:00Z",
781-
source: "weather-api"
786+
jsonrpc: "2.0",
787+
id: 1, // Matches the tools/call request id
788+
result: {
789+
content: [
790+
{ type: "text", text: "Current weather: Sunny, 72°F" }
791+
],
792+
structuredContent: {
793+
temperature: 72,
794+
conditions: "sunny",
795+
humidity: 45
796+
},
797+
_meta: {
798+
timestamp: "2025-11-10T15:30:00Z",
799+
source: "weather-api"
800+
}
782801
}
783802
}
784803

785-
// UI receives:
786-
Notification: ui/notifications/tool-result
787-
params: {
788-
content: [...], // Same as above
789-
structuredContent: { temperature: 72, ... },
790-
_meta: { timestamp: "...", ... }
804+
// UI receives (JSON-RPC notification):
805+
{
806+
jsonrpc: "2.0",
807+
method: "ui/notifications/tool-result",
808+
params: {
809+
content: [
810+
{ type: "text", text: "Current weather: Sunny, 72°F" }
811+
],
812+
structuredContent: {
813+
temperature: 72,
814+
conditions: "sunny",
815+
humidity: 45
816+
},
817+
_meta: {
818+
timestamp: "2025-11-10T15:30:00Z",
819+
source: "weather-api"
820+
}
821+
}
791822
}
792823
```
793824

@@ -812,7 +843,7 @@ This pattern enables interactive, self-updating widgets.
812843

813844
Note: The called tool may not appear in `tools/list` responses. MCP servers MAY expose private tools specifically designed for UI interaction that are not visible to the agent. UI implementations SHOULD attempt to call tools by name regardless of discoverability. The specification for Private Tools will be covered in a future SEP.
814845

815-
### Client<>Server Capability Negotiation
846+
### Client\<\>Server Capability Negotiation
816847

817848
Clients and servers negotiate MCP Apps support through the standard MCP extensions capability mechanism (defined in SEP-1724).
818849

0 commit comments

Comments
 (0)