Skip to content

Commit 237ee32

Browse files
authored
Support mcp image resource (#1962)
handle mcp image resource
1 parent 4fa4943 commit 237ee32

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/core/Cline.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,8 +2874,16 @@ export class Cline extends EventEmitter<ClineEvents> {
28742874
})
28752875
.filter(Boolean)
28762876
.join("\n\n") || "(Empty response)"
2877-
await this.say("mcp_server_response", resourceResultPretty)
2878-
pushToolResult(formatResponse.toolResult(resourceResultPretty))
2877+
2878+
// handle images (image must contain mimetype and blob)
2879+
let images: string[] = []
2880+
resourceResult?.contents.forEach((item) => {
2881+
if (item.mimeType?.startsWith("image") && item.blob) {
2882+
images.push(item.blob)
2883+
}
2884+
});
2885+
await this.say("mcp_server_response", resourceResultPretty, images)
2886+
pushToolResult(formatResponse.toolResult(resourceResultPretty, images))
28792887
break
28802888
}
28812889
} catch (error) {

0 commit comments

Comments
 (0)