Skip to content

Commit 521cc6f

Browse files
committed
instead of embedded, let us link
1 parent 4aba6c5 commit 521cc6f

File tree

32 files changed

+55
-44
lines changed

32 files changed

+55
-44
lines changed

β€Žexercises/03.resources/01.solution.simple/src/resources.tsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ export async function initializeResources(agent: EpicMeMCP) {
66
'epicme://tags',
77
{
88
title: 'Tags',
9-
description: 'All tags',
9+
description: 'All tags currently in the database',
1010
},
11-
async (uri: URL) => {
11+
async (uri) => {
1212
const tags = await agent.db.getTags()
1313
return {
1414
contents: [

β€Žexercises/03.resources/02.solution.template/src/resources.tsβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export async function initializeResources(agent: EpicMeMCP) {
77
'tags',
88
'epicme://tags',
99
{
10-
title: 'All tags',
10+
title: 'Tags',
1111
description: 'All tags currently in the database',
1212
},
1313
async (uri) => {
@@ -31,7 +31,7 @@ export async function initializeResources(agent: EpicMeMCP) {
3131
}),
3232
{
3333
title: 'Tag',
34-
description: 'A tag by ID',
34+
description: 'A single tag with the given ID',
3535
},
3636
async (uri, { id }) => {
3737
const tag = await agent.db.getTag(Number(id))
@@ -54,8 +54,8 @@ export async function initializeResources(agent: EpicMeMCP) {
5454
list: undefined,
5555
}),
5656
{
57-
title: 'Entry',
58-
description: 'A single entry',
57+
title: 'Journal Entry',
58+
description: 'A single journal entry with the given ID',
5959
},
6060
async (uri, { id }) => {
6161
const entry = await agent.db.getEntry(Number(id))

β€Žexercises/03.resources/03.problem.list/src/resources.tsβ€Ž

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export async function initializeResources(agent: EpicMeMCP) {
77
'tags',
88
'epicme://tags',
99
{
10-
title: 'All tags',
11-
description: 'All tags',
10+
title: 'Tags',
11+
description: 'All tags currently in the database',
1212
},
1313
async (uri) => {
1414
const tags = await agent.db.getTags()
@@ -32,8 +32,8 @@ export async function initializeResources(agent: EpicMeMCP) {
3232
list: undefined,
3333
}),
3434
{
35-
title: 'A single tag',
36-
description: 'A single tag',
35+
title: 'Tag',
36+
description: 'A single tag with the given ID',
3737
},
3838
async (uri, { id }) => {
3939
const tag = await agent.db.getTag(Number(id))
@@ -58,8 +58,8 @@ export async function initializeResources(agent: EpicMeMCP) {
5858
list: undefined,
5959
}),
6060
{
61-
title: 'A single entry',
62-
description: 'A single entry',
61+
title: 'Journal Entry',
62+
description: 'A single journal entry with the given ID',
6363
},
6464
async (uri, { id }) => {
6565
const entry = await agent.db.getEntry(Number(id))

β€Žexercises/03.resources/03.solution.list/src/resources.tsβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export async function initializeResources(agent: EpicMeMCP) {
4040
}),
4141
{
4242
title: 'Tag',
43-
description: 'A tag by ID',
43+
description: 'A single tag with the given ID',
4444
},
4545
async (uri, { id }) => {
4646
const tag = await agent.db.getTag(Number(id))
@@ -72,8 +72,8 @@ export async function initializeResources(agent: EpicMeMCP) {
7272
},
7373
}),
7474
{
75-
title: 'Entry',
76-
description: 'A single entry',
75+
title: 'Journal Entry',
76+
description: 'A single journal entry with the given ID',
7777
},
7878
async (uri, { id }) => {
7979
const entry = await agent.db.getEntry(Number(id))

β€Žexercises/03.resources/04.problem.completion/src/resources.tsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export async function initializeResources(agent: EpicMeMCP) {
77
'tags',
88
'epicme://tags',
99
{
10-
description: 'All tags',
11-
title: 'All tags that exist in the database currently',
10+
title: 'Tags',
11+
description: 'All tags currently in the database',
1212
},
1313
async (uri) => {
1414
const tags = await agent.db.getTags()
Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
1-
# Embedded Resources
1+
# Linked Resources
22

33
πŸ‘¨β€πŸ’Ό You've already made your resources discoverable and accessibleβ€”now let's make
4-
them even more useful! In this step, you'll learn how to embed a resource
4+
them even more useful! In this step, you'll learn how to link a resource
55
directly in your tool responses.
66

77
Why does this matter? Sometimes, a tool's output isn't just plain textβ€”it might
8-
be a file, a database record, or some other structured data. By embedding
8+
be a file, a database record, or some other structured data. By linking to
99
resource references, you enable clients (and LLMs) to follow links to additional
1010
context, download files, subscribe to updates, or fetch related data on demand.
1111

1212
Your goal in this step:
1313

1414
- Update your tools so that, when they create a tag, we tell them it was created
15-
and also include a reference to the tag (using the `type: 'resource'` content
16-
type in the response).
15+
and also include a reference to the tag (using the `type: 'resource_link'`
16+
content type in the response).
1717
- Make sure the resource includes the correct URI and metadata, so clients can
1818
easily fetch the resource if they want more details.
19-
- Include the resource itself in the response, so clients can use it directly.
2019

2120
This pattern unlocks powerful workflowsβ€”tools and resources working together to
2221
provide richer, more actionable results.
2322

23+
Here's an example of the content type if we were to link to a taco ingredient
24+
resource:
25+
26+
```json
27+
{
28+
"type": "resource_link",
29+
"uri": "taco://ingredients/1",
30+
"name": "Lettuce",
31+
"description": "A delicious lettuce ingredient",
32+
"mimeType": "application/json"
33+
}
34+
```
35+
2436
To test this out, create a new tag and notice the resource is included in the
2537
response.
2638

27-
- πŸ“œ [MCP Spec: Tools (Embedded Resources)](https://modelcontextprotocol.io/specification/2025-06-18/server/tools#embedded-resources)
39+
- πŸ“œ [MCP Spec: Tools (Resource Links)](https://modelcontextprotocol.io/specification/2025-06-18/server/tools#resource-links)

β€Žexercises/03.resources/05.problem.embedded/package.jsonβ€Ž renamed to β€Žexercises/03.resources/05.problem.linked/package.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "exercises_03.resources_05.problem.embedded",
2+
"name": "exercises_03.resources_05.problem.linked",
33
"private": true,
44
"type": "module",
55
"scripts": {

0 commit comments

Comments
Β (0)