Through part 3 the client knew what to show because we wrote it here. Now we do not.
Three lines
final read = await client.readResource('ui://desk');
final text = read.contents.first.text!;
final screen = jsonDecode(text) as Map<String, dynamic>;
ui://desk — 546 B, 6 lines, type "page", title "Desk"
nothing about this screen is written in the client
In a Flutter host this goes on to MCPUIRuntime.initialize(screen). The course sample stays plain Dart so anyone can run it, and confirms only that it arrived and that it is a screen.
What is absent
Things this file does not contain:
- a widget tree
- colours and font sizes
- button labels
- which button calls which tool
All of it is in the document the server gave. The client is plumbing that receives that document and hands it to a runtime.
So when the server changes the screen, the client does nothing. Just as server part 4 changed fontSize from 88 to 120 without stopping the server, this side does not rebuild.
546 bytes
One screen is 546 bytes. Six lines.
That the number looks small is the point. When moving a screen is cheap, moving it becomes the default. If every change means shipping an app, the screen belongs inside the app; if it means fetching one document, it belongs outside.
This content requires Developer or above
Sign in and upgrade your plan to continue reading.
View Plans