( block: McpResourceBlock, toolName: string, )
| 234 | } |
| 235 | |
| 236 | function transformResourceBlock( |
| 237 | block: McpResourceBlock, |
| 238 | toolName: string, |
| 239 | ): Part | Part[] | null { |
| 240 | const resource = block.resource; |
| 241 | if (resource?.text) { |
| 242 | return { text: resource.text }; |
| 243 | } |
| 244 | if (resource?.blob) { |
| 245 | const mimeType = resource.mimeType || 'application/octet-stream'; |
| 246 | return [ |
| 247 | { |
| 248 | text: `[Tool '${toolName}' provided the following embedded resource with mime-type: ${mimeType}]`, |
| 249 | }, |
| 250 | { |
| 251 | inlineData: { |
| 252 | mimeType, |
| 253 | data: resource.blob, |
| 254 | }, |
| 255 | }, |
| 256 | ]; |
| 257 | } |
| 258 | return null; |
| 259 | } |
| 260 | |
| 261 | function transformResourceLinkBlock(block: McpResourceLinkBlock): Part { |
| 262 | return { |
no outgoing calls
no test coverage detected