How can a prompt reference embedded resources within its returned messages?
Quick Answer
A message's content isn't limited to plain text — it can be an embedded resource block (type: "resource") that inlines an actual resource's contents (text or blob) directly into the message, addressed by its URI. This lets a prompt template pull in live data at render time — for example, a /summarize-changelog prompt could embed the current CHANGELOG.md resource directly into its returned message rather than asking the model to separately call a tool or read a resource itself. It keeps the prompt self-contained: by the time the host injects the prompt's messages into the conversation, all the referenced context is already inline, with no extra round trip needed from the model.
Detailed Answer
Prompts and resources compose directly. A prompt's rendered messages can carry a resource's actual content inline, not just a reference to it.
Example: a prompt that embeds live data
{"result": {
"messages": [
{"role": "user", "content": {
"type": "resource",
"resource": {
"uri": "file:///project/CHANGELOG.md",
"mimeType": "text/markdown",
"text": "## v2.1.0\n- Fixed login bug\n- Added dark mode"
}
}},
{"role": "user", "content": {
"type": "text",
"text": "Summarize the above changelog for a non-technical release announcement."
}}
]
}}
Why embed rather than just mention the URI
If the prompt just said "read CHANGELOG.md and summarize it" as plain text, the model would need a separate tool call or resource read to get the content. That's an extra round trip, and it only works if the model happens to have a matching tool/resource-read capability available in that context. Embedding the resource's actual content directly into the returned message avoids that. The content is already present in the conversation the moment the prompt is invoked, with no dependency on the model fetching anything itself.
The tradeoff
Embedding content inflates the size of what prompts/get returns, and the content is a snapshot as of render time. If the underlying file changes a second later, the embedded copy in an already-rendered prompt won't reflect it, whereas a live resource read would. For small, relatively static reference material — a style guide, a fixed schema, a short changelog section — embedding is usually the right call. For something large or highly volatile, it may be better for the prompt to just instruct the model to use a tool/resource read case-by-case instead.