File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
exercises/01.advanced-tools
02.problem.structured/src
02.solution.structured/src Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ export async function initializeTools(agent: EpicMeMCP) {
41
41
}
42
42
}
43
43
44
+ // 🐨 refetch entry to get updated tags
45
+ // 💰 agent.db.getEntry(createdEntry.id)
46
+ // 💯 add invariant to check if the entry was found
47
+
44
48
// 🐨 create a structuredContent here that matches the outputSchema
45
49
return {
46
50
// 🐨 add structuredContent here
@@ -330,7 +334,7 @@ export async function initializeTools(agent: EpicMeMCP) {
330
334
openWorldHint : false ,
331
335
} satisfies ToolAnnotations ,
332
336
inputSchema : entryTagIdSchema ,
333
- // 🐨 add an outputSchema here with a success boolean and a tagEntry that is an entryTagSchema
337
+ // 🐨 add an outputSchema here with a success boolean and an entryTag that is an entryTagSchema
334
338
} ,
335
339
async ( { entryId, tagId } ) => {
336
340
const tag = await agent . db . getTag ( tagId )
@@ -382,7 +386,7 @@ export async function initializeTools(agent: EpicMeMCP) {
382
386
'If set to > 0, use mock mode and this is the mock wait time in milliseconds' ,
383
387
) ,
384
388
} ,
385
- // 🐨 add an outputSchema here with a video that includes videoUri (you're on your own here!)
389
+ // 🐨 add an outputSchema here with a videoUri field (you're on your own here!)
386
390
} ,
387
391
async ( { year = new Date ( ) . getFullYear ( ) , mockTime } ) => {
388
392
const entries = await agent . db . getEntries ( )
Original file line number Diff line number Diff line change @@ -41,14 +41,18 @@ export async function initializeTools(agent: EpicMeMCP) {
41
41
}
42
42
}
43
43
44
- const structuredContent = { entry : createdEntry }
44
+ // Refetch entry to get updated tags
45
+ const entryWithTags = await agent . db . getEntry ( createdEntry . id )
46
+ invariant ( entryWithTags , `Failed to refetch created entry` )
47
+
48
+ const structuredContent = { entry : entryWithTags }
45
49
return {
46
50
structuredContent,
47
51
content : [
48
52
createText (
49
- `Entry "${ createdEntry . title } " created successfully with ID "${ createdEntry . id } "` ,
53
+ `Entry "${ entryWithTags . title } " created successfully with ID "${ entryWithTags . id } "` ,
50
54
) ,
51
- createEntryResourceLink ( createdEntry ) ,
55
+ createEntryResourceLink ( entryWithTags ) ,
52
56
createText ( structuredContent ) ,
53
57
] ,
54
58
}
You can’t perform that action at this time.
0 commit comments