@@ -31,10 +31,10 @@ export async function initializeTools(agent: EpicMeMCP) {
3131 }
3232 return {
3333 content : [
34- createTextContent (
34+ createText (
3535 `Entry "${ createdEntry . title } " created successfully with ID "${ createdEntry . id } "` ,
3636 ) ,
37- createEntryEmbeddedResource ( createdEntry ) ,
37+ createText ( createdEntry ) ,
3838 ] ,
3939 }
4040 } ,
@@ -51,7 +51,7 @@ export async function initializeTools(agent: EpicMeMCP) {
5151 const entry = await agent . db . getEntry ( id )
5252 invariant ( entry , `Entry with ID "${ id } " not found` )
5353 return {
54- content : [ createEntryEmbeddedResource ( entry ) ] ,
54+ content : [ createText ( entry ) ] ,
5555 }
5656 } ,
5757 )
@@ -64,10 +64,10 @@ export async function initializeTools(agent: EpicMeMCP) {
6464 } ,
6565 async ( ) => {
6666 const entries = await agent . db . getEntries ( )
67- const entryLinks = entries . map ( createEntryResourceLink )
67+ const entryLinks = entries . map ( createText )
6868 return {
6969 content : [
70- createTextContent ( `Found ${ entries . length } entries.` ) ,
70+ createText ( `Found ${ entries . length } entries.` ) ,
7171 ...entryLinks ,
7272 ] ,
7373 }
@@ -88,10 +88,10 @@ export async function initializeTools(agent: EpicMeMCP) {
8888 const updatedEntry = await agent . db . updateEntry ( id , updates )
8989 return {
9090 content : [
91- createTextContent (
91+ createText (
9292 `Entry "${ updatedEntry . title } " (ID: ${ id } ) updated successfully` ,
9393 ) ,
94- createEntryEmbeddedResource ( updatedEntry ) ,
94+ createText ( updatedEntry ) ,
9595 ] ,
9696 }
9797 } ,
@@ -110,10 +110,10 @@ export async function initializeTools(agent: EpicMeMCP) {
110110 await agent . db . deleteEntry ( id )
111111 return {
112112 content : [
113- createTextContent (
113+ createText (
114114 `Entry "${ existingEntry . title } " (ID: ${ id } ) deleted successfully` ,
115115 ) ,
116- createEntryEmbeddedResource ( existingEntry ) ,
116+ createText ( existingEntry ) ,
117117 ] ,
118118 }
119119 } ,
@@ -130,10 +130,10 @@ export async function initializeTools(agent: EpicMeMCP) {
130130 const createdTag = await agent . db . createTag ( tag )
131131 return {
132132 content : [
133- createTextContent (
133+ createText (
134134 `Tag "${ createdTag . name } " created successfully with ID "${ createdTag . id } "` ,
135135 ) ,
136- createTagEmbeddedResource ( createdTag ) ,
136+ createText ( createdTag ) ,
137137 ] ,
138138 }
139139 } ,
@@ -150,7 +150,7 @@ export async function initializeTools(agent: EpicMeMCP) {
150150 const tag = await agent . db . getTag ( id )
151151 invariant ( tag , `Tag ID "${ id } " not found` )
152152 return {
153- content : [ createTagEmbeddedResource ( tag ) ] ,
153+ content : [ createText ( tag ) ] ,
154154 }
155155 } ,
156156 )
@@ -163,9 +163,9 @@ export async function initializeTools(agent: EpicMeMCP) {
163163 } ,
164164 async ( ) => {
165165 const tags = await agent . db . getTags ( )
166- const tagLinks = tags . map ( createTagResourceLink )
166+ const tagLinks = tags . map ( createText )
167167 return {
168- content : [ createTextContent ( `Found ${ tags . length } tags.` ) , ...tagLinks ] ,
168+ content : [ createText ( `Found ${ tags . length } tags.` ) , ...tagLinks ] ,
169169 }
170170 } ,
171171 )
@@ -181,10 +181,10 @@ export async function initializeTools(agent: EpicMeMCP) {
181181 const updatedTag = await agent . db . updateTag ( id , updates )
182182 return {
183183 content : [
184- createTextContent (
184+ createText (
185185 `Tag "${ updatedTag . name } " (ID: ${ id } ) updated successfully` ,
186186 ) ,
187- createTagEmbeddedResource ( updatedTag ) ,
187+ createText ( updatedTag ) ,
188188 ] ,
189189 }
190190 } ,
@@ -203,10 +203,10 @@ export async function initializeTools(agent: EpicMeMCP) {
203203 await agent . db . deleteTag ( id )
204204 return {
205205 content : [
206- createTextContent (
206+ createText (
207207 `Tag "${ existingTag . name } " (ID: ${ id } ) deleted successfully` ,
208208 ) ,
209- createTagEmbeddedResource ( existingTag ) ,
209+ createText ( existingTag ) ,
210210 ] ,
211211 }
212212 } ,
@@ -230,76 +230,21 @@ export async function initializeTools(agent: EpicMeMCP) {
230230 } )
231231 return {
232232 content : [
233- createTextContent (
233+ createText (
234234 `Tag "${ tag . name } " (ID: ${ entryTag . tagId } ) added to entry "${ entry . title } " (ID: ${ entryTag . entryId } ) successfully` ,
235235 ) ,
236- createTagEmbeddedResource ( tag ) ,
237- createEntryEmbeddedResource ( entry ) ,
236+ createText ( tag ) ,
237+ createText ( entry ) ,
238238 ] ,
239239 }
240240 } ,
241241 )
242242}
243243
244- function createTextContent ( text : unknown ) : CallToolResult [ 'content' ] [ number ] {
244+ function createText ( text : unknown ) : CallToolResult [ 'content' ] [ number ] {
245245 if ( typeof text === 'string' ) {
246246 return { type : 'text' , text }
247247 } else {
248248 return { type : 'text' , text : JSON . stringify ( text ) }
249249 }
250250}
251-
252- type ResourceLinkContent = Extract <
253- CallToolResult [ 'content' ] [ number ] ,
254- { type : 'resource_link' }
255- >
256-
257- function createEntryResourceLink ( entry : {
258- id : number
259- title : string
260- } ) : ResourceLinkContent {
261- return {
262- type : 'resource_link' ,
263- uri : `epicme://entries/${ entry . id } ` ,
264- name : entry . title ,
265- description : `Journal Entry: "${ entry . title } "` ,
266- mimeType : 'application/json' ,
267- }
268- }
269-
270- function createTagResourceLink ( tag : {
271- id : number
272- name : string
273- } ) : ResourceLinkContent {
274- return {
275- type : 'resource_link' ,
276- uri : `epicme://tags/${ tag . id } ` ,
277- name : tag . name ,
278- description : `Tag: "${ tag . name } "` ,
279- mimeType : 'application/json' ,
280- }
281- }
282-
283- type ResourceContent = CallToolResult [ 'content' ] [ number ]
284-
285- function createEntryEmbeddedResource ( entry : { id : number } ) : ResourceContent {
286- return {
287- type : 'resource' ,
288- resource : {
289- uri : `epicme://entries/${ entry . id } ` ,
290- mimeType : 'application/json' ,
291- text : JSON . stringify ( entry ) ,
292- } ,
293- }
294- }
295-
296- function createTagEmbeddedResource ( tag : { id : number } ) : ResourceContent {
297- return {
298- type : 'resource' ,
299- resource : {
300- uri : `epicme://tags/${ tag . id } ` ,
301- mimeType : 'application/json' ,
302- text : JSON . stringify ( tag ) ,
303- } ,
304- }
305- }
0 commit comments