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) {
4141				} 
4242			} 
4343
44+ 			// 🐨 refetch entry to get updated tags 
45+ 			// 💰 agent.db.getEntry(createdEntry.id) 
46+ 			// 💯 add invariant to check if the entry was found 
47+ 
4448			// 🐨 create a structuredContent here that matches the outputSchema 
4549			return  { 
4650				// 🐨 add structuredContent here 
@@ -330,7 +334,7 @@ export async function initializeTools(agent: EpicMeMCP) {
330334				openWorldHint : false , 
331335			}  satisfies  ToolAnnotations , 
332336			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 
334338		} , 
335339		async  ( {  entryId,  tagId } )  =>  { 
336340			const  tag  =  await  agent . db . getTag ( tagId ) 
@@ -382,7 +386,7 @@ export async function initializeTools(agent: EpicMeMCP) {
382386						'If set to > 0, use mock mode and this is the mock wait time in milliseconds' , 
383387					) , 
384388			} , 
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!) 
386390		} , 
387391		async  ( {  year =  new  Date ( ) . getFullYear ( ) ,  mockTime } )  =>  { 
388392			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) {
4141				} 
4242			} 
4343
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  } 
4549			return  { 
4650				structuredContent, 
4751				content : [ 
4852					createText ( 
49- 						`Entry "${ createdEntry . title } ${ createdEntry . id }  , 
53+ 						`Entry "${ entryWithTags . title } ${ entryWithTags . id }  , 
5054					) , 
51- 					createEntryResourceLink ( createdEntry ) , 
55+ 					createEntryResourceLink ( entryWithTags ) , 
5256					createText ( structuredContent ) , 
5357				] , 
5458			} 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments