( result: CompatibilityCallToolResult )
| 223 | * ``` |
| 224 | */ |
| 225 | export function extractImage( |
| 226 | result: CompatibilityCallToolResult |
| 227 | ): ExtractedImage | undefined { |
| 228 | const r = result as MCPResultWithContent; |
| 229 | if (!r.content) return undefined; |
| 230 | const imageContent = r.content.find((c) => c.type === "image"); |
| 231 | if (!imageContent?.data || !imageContent.mimeType) return undefined; |
| 232 | |
| 233 | if (!isValidImageMimeType(imageContent.mimeType)) { |
| 234 | return undefined; |
| 235 | } |
| 236 | |
| 237 | return { |
| 238 | data: imageContent.data, |
| 239 | mimeType: imageContent.mimeType, |
| 240 | }; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * MCP client wrapper providing type-safe tool calls and lifecycle management. |
no test coverage detected