Ch 5 — Resources Under the Hood

Wire formats, content types, embedded resources, SDK patterns, and list-changed notifications
Under the Hood
-
Click play or press Space to begin...
Step- / 10
AWire FormatJSON-RPC messages for resources/list and resources/read
1
list
resources/listRequest returns
array of descriptors
pick URI
2
download
resources/readRequest with URI
returns contents[]
3
arrow_downward Content types: text vs blob
BContent TypesText content, binary blobs, and multi-part responses
text_snippet
TextContent"text" field
UTF-8 string
or
image
BlobContent"blob" field
base64-encoded
multi
4
layers
Multi-Partcontents[] can
have many items
5
arrow_downward Resource templates: wire format and completion
CTemplate Wire FormatListing templates and completing parameters
view_list
templates/listReturns array of
uriTemplate objects
fill
auto_awesome
completionAutocomplete
template params
resolve
6
link
Read Resolvedresources/read
with concrete URI
7
arrow_downward Embedded resources in tool results
DEmbedded ResourcesTools can return resource references inside their results
build
Tool Calltools/call returns
a result
contains
attach_file
EmbeddedResourceResource content
inside tool result
injected
psychology
LLM ContextHost adds to
conversation
8
arrow_downward Subscription internals and list-changed
ESubscription InternalsSubscribe, unsubscribe, updated, and list_changed notifications
notifications
subscribeWatch a single
resource URI
notify
update
updatedContent changed
notification
vs
9
playlist_add
list_changedSet of resources
added or removed
10
arrow_downward SDK patterns: defining resources in code
FSDK PatternsDefining resources and templates in Python and TypeScript
code
Python SDK@mcp.resource()
decorator pattern
or
javascript
TypeScript SDKserver.resource()
method pattern
1
Detail