Skip to content

Commit 580e319

Browse files
committed
instructions left
1 parent db49128 commit 580e319

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

β€Žexercises/03.advanced-tools/02.problem.organization/src/index.tsβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
22
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
33
import { z } from 'zod'
44
import { DB } from './db/index.ts'
5-
// 🐨 Make tools.ts and you'll export a function called initializeTools:
5+
// πŸ’° Make tools.ts and you'll export a function called initializeTools:
66
// import { initializeTools } from './tools.ts'
77

88
const db = DB.getInstance('./db.sqlite')
@@ -27,6 +27,7 @@ You can also help users add tags to their entries and get all tags for an entry.
2727
)
2828

2929
// 🐨 move this tool to a function called `initializeTools` in a separate file ./tools.ts
30+
// πŸ’° it should accept the server and db as arguments
3031
server.tool(
3132
'create_tag',
3233
'Create a new tag',

β€Žexercises/04.resources/01.problem.simple/src/index.test.tsβ€Ž

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ test('Tool Definition', async () => {
2828

2929
expect(firstTool).toEqual(
3030
expect.objectContaining({
31-
name: expect.stringMatching(/^add$/i),
32-
description: expect.stringMatching(/^add two numbers$/i),
31+
name: expect.stringMatching(/^create_entry$/i),
32+
description: expect.stringMatching(/^create a new journal entry$/i),
3333
inputSchema: expect.objectContaining({
3434
type: 'object',
3535
properties: expect.objectContaining({
36-
firstNumber: expect.objectContaining({
37-
type: 'number',
38-
description: expect.stringMatching(/first/i),
36+
title: expect.objectContaining({
37+
type: 'string',
38+
description: expect.stringMatching(/title/i),
39+
}),
40+
content: expect.objectContaining({
41+
type: 'string',
42+
description: expect.stringMatching(/content/i),
3943
}),
4044
}),
4145
}),
@@ -45,10 +49,10 @@ test('Tool Definition', async () => {
4549

4650
test('Tool Call', async () => {
4751
const result = await client.callTool({
48-
name: 'add',
52+
name: 'create_entry',
4953
arguments: {
50-
firstNumber: 1,
51-
secondNumber: 2,
54+
title: 'Test Entry',
55+
content: 'This is a test entry',
5256
},
5357
})
5458

@@ -57,7 +61,9 @@ test('Tool Call', async () => {
5761
content: expect.arrayContaining([
5862
expect.objectContaining({
5963
type: 'text',
60-
text: expect.stringMatching(/3/),
64+
text: expect.stringMatching(
65+
/Entry "Test Entry" created successfully/,
66+
),
6167
}),
6268
]),
6369
}),

β€Žexercises/04.resources/01.problem.simple/src/index.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
22
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
33
import { DB } from './db/index.ts'
4-
// 🐨 bring in initializeResources from the new ./resources.ts file
4+
// πŸ’° bring in initializeResources from the new ./resources.ts file
55
// import { initializeResources } from './resources.ts'
66
import { initializeTools } from './tools.ts'
77

β€Žexercises/04.resources/01.problem.simple/src/resources.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// 🐨 you'll use this to get the username of the creator of the app
1+
// πŸ’° you'll use this to get the username of the creator of the app
22
// import { userInfo } from 'node:os'
33
import { type EpicMeMCP } from './index.ts'
44

β€Žexercises/04.resources/02.problem.template/src/resources.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { userInfo } from 'node:os'
2-
// 🐨 you'll use both of these in this exercise:
2+
// πŸ’° you'll use both of these in this exercise:
33
// import { invariant } from '@epic-web/invariant'
44
// import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'
55
import { type ReadResourceResult } from '@modelcontextprotocol/sdk/types.js'

0 commit comments

Comments
Β (0)