extractMCPImageUrls
extractMCPImageUrls(
content:string,toolCallEvents:ToolCallEvent[] |undefined,mcpR2Domain:string):ExtractedMediaUrl[]
Defined in: src/lib/storage/mcpImages.ts:96
Extracts MCP media URLs from tool_call_events (primary) or content (fallback).
Primary path: parses JSON output of image- and video-generation tool calls. Fallback path: regex-matches MCP R2 domain URLs in content and classifies each by file extension (so videos aren’t mislabeled as images).
The function name is retained for call-site stability; it now returns videos
too, each tagged with mediaType.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
|
The message content (may contain markdown/HTML media refs) |
|
|
|
Tool call events from streaming accumulator |
|
|
|
The R2 domain to match |
Returns
ExtractedMediaUrl[]
Array of extracted URLs with model + mediaType info