Skip to content

Commit 5486b6c

Browse files
committed
fix the first exercise
1 parent ad22da2 commit 5486b6c

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
// 💰 you'll use this to get the username of the creator of the app
2-
// import { userInfo } from 'node:os'
31
import { type EpicMeMCP } from './index.ts'
42

53
export async function initializeResources(agent: EpicMeMCP) {
6-
// 🐨 create a resource called "credits" with the URI epicme://credits
7-
// this tool will return a string with the credits for the creators of the app
8-
// so set the description to explain that
4+
// 🐨 create a resource called "tags" with the URI epicme://tags
5+
// this tool will return all the tags from the database. Write a description for that.
96
// 🐨 the handler accepts the uri and returns the contents array which should
10-
// have an object with mimeType text/plain, text, and uri
11-
// 💰 You can use this for the text:
12-
// `This app was created by ${userInfo().username}`
7+
// have an object with mimeType application/json, text, and uri
8+
// 💰 You can use this to get the tags
9+
// `await agent.db.getTags()`
1310
}

exercises/03.resources/01.solution.simple/src/resources.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ import { type EpicMeMCP } from './index.ts'
33

44
export async function initializeResources(agent: EpicMeMCP) {
55
agent.server.resource(
6-
'credits',
7-
'epicme://credits',
8-
{
9-
description: 'Credits for the creators of the app',
10-
},
6+
'tags',
7+
'epicme://tags',
8+
{ description: 'All tags' },
119
async (uri) => {
10+
const tags = await agent.db.getTags()
1211
return {
1312
contents: [
1413
{
15-
mimeType: 'text/plain',
16-
text: `This app was created by ${userInfo().username}`,
14+
mimeType: 'application/json',
15+
text: JSON.stringify(tags),
1716
uri: uri.toString(),
1817
},
1918
],

0 commit comments

Comments
 (0)