File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -111,8 +111,8 @@ export function listMCPTools(
111111function getResourceData (
112112 resource : TextResourceContents | BlobResourceContents ,
113113) : string {
114- if ( 'text' in resource ) return resource . text
115- if ( 'blob' in resource ) return resource . blob
114+ if ( 'text' in resource ) return resource . text as string
115+ if ( 'blob' in resource ) return resource . blob as string
116116 return ''
117117}
118118
@@ -154,9 +154,12 @@ export async function callMCPTool(
154154 mediaType : c . resource . mimeType ?? 'text/plain' ,
155155 } satisfies ToolResultOutput
156156 }
157+ const fallbackValue = 'uri' in c && typeof ( c as { uri : unknown } ) . uri === 'string'
158+ ? ( c as { uri : string } ) . uri
159+ : JSON . stringify ( c )
157160 return {
158161 type : 'json' ,
159- value : c . uri ,
162+ value : fallbackValue ,
160163 } satisfies ToolResultOutput
161164 } )
162165}
You can’t perform that action at this time.
0 commit comments