fix(mcp): support resource content type in MCP tool output (#7879)
This commit is contained in:
@@ -777,8 +777,23 @@ export namespace SessionPrompt {
|
|||||||
mime: contentItem.mimeType,
|
mime: contentItem.mimeType,
|
||||||
url: `data:${contentItem.mimeType};base64,${contentItem.data}`,
|
url: `data:${contentItem.mimeType};base64,${contentItem.data}`,
|
||||||
})
|
})
|
||||||
|
} else if (contentItem.type === "resource") {
|
||||||
|
const { resource } = contentItem
|
||||||
|
if (resource.text) {
|
||||||
|
textParts.push(resource.text)
|
||||||
|
}
|
||||||
|
if (resource.blob) {
|
||||||
|
attachments.push({
|
||||||
|
id: Identifier.ascending("part"),
|
||||||
|
sessionID: input.session.id,
|
||||||
|
messageID: input.processor.message.id,
|
||||||
|
type: "file",
|
||||||
|
mime: resource.mimeType ?? "application/octet-stream",
|
||||||
|
url: `data:${resource.mimeType ?? "application/octet-stream"};base64,${resource.blob}`,
|
||||||
|
filename: resource.uri,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Add support for other types if needed
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user