Skip to content

Commit 921c145

Browse files
committed
add back embedded exercise
1 parent 521cc6f commit 921c145

File tree

41 files changed

+2788
-209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2788
-209
lines changed

epicshop/package-lock.json

Lines changed: 30 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

epicshop/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"type": "module",
33
"dependencies": {
4-
"@epic-web/workshop-app": "^5.23.0",
5-
"@epic-web/workshop-utils": "^5.23.0",
4+
"@epic-web/workshop-app": "^5.23.1",
5+
"@epic-web/workshop-utils": "^5.23.1",
66
"chokidar": "^4.0.3",
77
"enquirer": "^2.4.1",
88
"execa": "^9.6.0",

exercises/03.resources/05.solution.linked/README.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,3 @@ Key takeaways from this step:
1818

1919
With this, your MCP server is ready to power truly context-aware, intelligent
2020
applications. Great job!
21-
22-
🧝‍♂️ I'm going to apply what we just did to all the tools. If you'd like to
23-
check out my changes, you can <NextDiffLink>here</NextDiffLink>.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Embedded Resources
2+
3+
👨‍💼 Right now we have a `get_entry` tool that returns a journal entry. So LLMs
4+
can decide to get the entry details if it's relevant to the task. We also have
5+
a resource for getting entries by IDs as well.
6+
7+
The MCP spec has a `resource` content type that allows you to embed resources
8+
in tool responses. So instead of just returning the entry details, we can
9+
include the entry resource in the response so the MCP client can subscribe to it
10+
or request it again in the future.
11+
12+
Here's an example of the content type if we were to embed a taco resource:
13+
14+
```json
15+
{
16+
"type": "resource",
17+
"resource": {
18+
"uri": "taco://ingredients/1",
19+
"mimeType": "application/json",
20+
"text": "{\"name\": \"Lettuce\", \"description\": \"A delicious lettuce ingredient\"}"
21+
}
22+
}
23+
```
24+
25+
Let's update the `get_entry` tool to embed the entry resource in the response.
26+
Test this out by using the `get_entry` tool and make sure it shows the resource
27+
info in the response.
28+
29+
📜 [MCP Spec: Tools (Embedded Resources)](https://modelcontextprotocol.io/specification/2025-06-18/server/tools#embedded-resources)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "exercises_03.resources_06.problem.linked",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"dev": "mcp-dev",
7+
"dev:mcp": "tsx src/index.ts",
8+
"test": "vitest",
9+
"typecheck": "tsc",
10+
"inspect": "mcp-inspector"
11+
},
12+
"dependencies": {
13+
"@epic-web/invariant": "^1.0.0",
14+
"@modelcontextprotocol/sdk": "npm:@kentcdodds/[email protected]",
15+
"zod": "^3.25.67"
16+
},
17+
"devDependencies": {
18+
"@epic-web/config": "^1.21.0",
19+
"@epic-web/mcp-dev": "*",
20+
"@faker-js/faker": "^9.8.0",
21+
"@kentcdodds/tmp-modelcontextprotocol_inspector": "^0.14.3-alpha.0",
22+
"@types/node": "^24.0.3",
23+
"tsx": "^4.20.3",
24+
"typescript": "^5.8.3",
25+
"vitest": "^3.2.4"
26+
},
27+
"license": "GPL-3.0-only"
28+
}

0 commit comments

Comments
 (0)