MCPcopy Create free account
hub / github.com/WebMCP-org/chrome-devtools-quickstart / extractImage

Function extractImage

benchmark/helpers.ts:225–241  ·  view source on GitHub ↗
(
  result: CompatibilityCallToolResult
)

Source from the content-addressed store, hash-verified

223 * ```
224 */
225export 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.

Callers 1

captureAndAnalyzeFunction · 0.85

Calls 1

isValidImageMimeTypeFunction · 0.85

Tested by

no test coverage detected