Skip to content

Commit 19cd001

Browse files
authored
fix access_mcp_resource fails to handle images correctly (#5254)
1 parent 1cb69d2 commit 19cd001

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/core/tools/accessMcpResourceTool.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ export async function accessMcpResourceTool(
7373

7474
resourceResult?.contents.forEach((item) => {
7575
if (item.mimeType?.startsWith("image") && item.blob) {
76-
images.push(item.blob)
76+
if (item.blob.startsWith("data:")) {
77+
images.push(item.blob)
78+
} else {
79+
images.push(`data:${item.mimeType};base64,` + item.blob)
80+
}
7781
}
7882
})
7983

0 commit comments

Comments
 (0)