mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Support original-detail metadata on MCP image outputs (#17714)
## Summary - honor `_meta["codex/imageDetail"] == "original"` on MCP image content and map it to `detail: "original"` where supported - strip that detail back out when the active model does not support original-detail image inputs - update code-mode `image(...)` to accept individual MCP image blocks - teach `js_repl` / `codex.emitImage(...)` to preserve the same hint from raw MCP image outputs - document the new `_meta` contract and add generic RMCP-backed coverage across protocol, core, code-mode, and js_repl paths
This commit is contained in:
@@ -1330,6 +1330,13 @@ function normalizeMcpImageData(data, mimeType) {
|
||||
return `data:${normalizedMimeType};base64,${data}`;
|
||||
}
|
||||
|
||||
function parseMcpImageDetail(meta) {
|
||||
if (!isPlainObject(meta) || meta["codex/imageDetail"] !== "original") {
|
||||
return undefined;
|
||||
}
|
||||
return "original";
|
||||
}
|
||||
|
||||
function parseMcpToolResult(result) {
|
||||
if (typeof result === "string") {
|
||||
return { images: [], textCount: result.length > 0 ? 1 : 0 };
|
||||
@@ -1362,6 +1369,7 @@ function parseMcpToolResult(result) {
|
||||
if (item.type === "image") {
|
||||
images.push({
|
||||
image_url: normalizeMcpImageData(item.data, item.mimeType ?? item.mime_type),
|
||||
detail: parseMcpImageDetail(item._meta),
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user