Skip to content

Add a content helper for forwarding MCP blocks in Code Mode - #60665

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/83832ec6c530dd35ea1e3373680627997c6e13c1
Nov 10, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/83832ec6c530dd35ea1e3373680627997c6e13c1

Conversation

@copyberry

@copyberry copyberry Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Add a content helper for forwarding MCP blocks in Code Mode

Why

Code Mode needs a way to forward mixed MCP tool results while preserving their content types and order.

What changed

Add content(block) and content(iterable) so callers can forward tool output with content(result.content). Text, image, and audio blocks become their corresponding output items; resource links and embedded resources are serialized as text. Invalid blocks and encrypted text are rejected, and iterators are closed when a block is rejected.

Share MCP block conversion and image detail types with the protocol layer, while preserving existing image() and audio() input handling.

Testing

Add coverage for mixed content ordering, iterator behavior and cleanup, invalid blocks, image metadata, short audio clips, and output suppression after exit. Add an integration scenario verifying that MCP text and image blocks reach the model in order.

## Why

Code Mode needs a way to forward mixed MCP tool results while preserving their content types and order.

## What changed

Add `content(block)` and `content(iterable)` so callers can forward tool output with `content(result.content)`. Text, image, and audio blocks become their corresponding output items; resource links and embedded resources are serialized as text. Invalid blocks and encrypted text are rejected, and iterators are closed when a block is rejected.

Share MCP block conversion and image detail types with the protocol layer, while preserving existing `image()` and `audio()` input handling.

## Testing

Add coverage for mixed content ordering, iterator behavior and cleanup, invalid blocks, image metadata, short audio clips, and output suppression after exit. Add an integration scenario verifying that MCP text and image blocks reach the model in order.

GitOrigin-RevId: 83832ec6c530dd35ea1e3373680627997c6e13c1
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/83832ec6c530dd35ea1e3373680627997c6e13c1 branch from f1952ac to 733a1cc Compare November 10, 2026 21:28
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor
Codex Review Summary: 🔄 Running

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-11-10T21:28:45.179277Z f1952ac PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot merged commit 733a1cc into main Nov 10, 2026
8 of 23 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/83832ec6c530dd35ea1e3373680627997c6e13c1 branch November 10, 2026 21:28
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 10, 2026

This branch was successfully deployed

1 active and 1 inactive deployments
pypi — 733a1cca Deployed Nov 10, 2026 by imac-oai via publish-python-sdk #399
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants