mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Deduplicate MCP text fallbacks in Code Mode output (#63540)
## Why MCP tools can return structured data alongside a JSON text fallback for clients that need it. Printing the whole result in Code Mode can show the same data twice. ## What changed Enable `features.code_mode_mcp_result_dedup` to let `text()` omit `content` when it prints an original, successful MCP result whose only content block is a plain text fallback that parses to the same JSON as `structuredContent`. The JavaScript result retains both fields. Carry the result format through gRPC so the host can distinguish MCP results from ordinary JSON. The feature is off by default. ## Testing Add coverage for both feature flag settings, for printing original MCP results and copies through gRPC, and for comparing equivalent JSON. GitOrigin-RevId: a8b0b42f5375d9744c235a0e663090dd5982e37e
This commit is contained in:
@@ -87,7 +87,9 @@ pub(super) fn text_callback(
|
||||
} else {
|
||||
args.get(0)
|
||||
};
|
||||
let can_omit_fallback = super::mcp_result::can_omit_fallback(scope, value);
|
||||
let text = match serialize_output_text(scope, value) {
|
||||
Ok(text) if can_omit_fallback => super::mcp_result::without_fallback(&text).unwrap_or(text),
|
||||
Ok(text) => text,
|
||||
Err(error_text) => {
|
||||
throw_type_error(scope, &error_text);
|
||||
|
||||
Reference in New Issue
Block a user