mirror of
https://github.com/openai/codex.git
synced 2026-11-19 22:30:42 +00:00
Add output schema to MCP tools and expose MCP tool results in code mode (#14236)
Summary - drop `McpToolOutput` in favor of `CallToolResult`, moving its helpers to keep MCP tooling focused on the final result shape - wire the new schema definitions through code mode, context, handlers, and spec modules so MCP tools serialize the exact output shape expected by the model - extend code mode tests to cover multiple MCP call scenarios and ensure the serialized data matches the new schema - refresh JS runner helpers and protocol models alongside the schema changes Testing - Not run (not requested)
This commit is contained in:
@@ -58,7 +58,6 @@ use codex_app_server_protocol::AppInfo;
|
||||
use codex_otel::TelemetryAuthMode;
|
||||
use codex_protocol::models::BaseInstructions;
|
||||
use codex_protocol::models::ContentItem;
|
||||
use codex_protocol::models::McpToolOutput;
|
||||
use codex_protocol::models::ResponseInputItem;
|
||||
use codex_protocol::models::ResponseItem;
|
||||
use codex_protocol::openai_models::ModelsResponse;
|
||||
@@ -1628,7 +1627,7 @@ fn prefers_structured_content_when_present() {
|
||||
meta: None,
|
||||
};
|
||||
|
||||
let got = McpToolOutput::from(&ctr).into_function_call_output_payload();
|
||||
let got = ctr.into_function_call_output_payload();
|
||||
let expected = FunctionCallOutputPayload {
|
||||
body: FunctionCallOutputBody::Text(
|
||||
serde_json::to_string(&json!({
|
||||
@@ -1710,7 +1709,7 @@ fn falls_back_to_content_when_structured_is_null() {
|
||||
meta: None,
|
||||
};
|
||||
|
||||
let got = McpToolOutput::from(&ctr).into_function_call_output_payload();
|
||||
let got = ctr.into_function_call_output_payload();
|
||||
let expected = FunctionCallOutputPayload {
|
||||
body: FunctionCallOutputBody::Text(
|
||||
serde_json::to_string(&vec![text_block("hello"), text_block("world")]).unwrap(),
|
||||
@@ -1730,7 +1729,7 @@ fn success_flag_reflects_is_error_true() {
|
||||
meta: None,
|
||||
};
|
||||
|
||||
let got = McpToolOutput::from(&ctr).into_function_call_output_payload();
|
||||
let got = ctr.into_function_call_output_payload();
|
||||
let expected = FunctionCallOutputPayload {
|
||||
body: FunctionCallOutputBody::Text(
|
||||
serde_json::to_string(&json!({ "message": "bad" })).unwrap(),
|
||||
@@ -1750,7 +1749,7 @@ fn success_flag_true_with_no_error_and_content_used() {
|
||||
meta: None,
|
||||
};
|
||||
|
||||
let got = McpToolOutput::from(&ctr).into_function_call_output_payload();
|
||||
let got = ctr.into_function_call_output_payload();
|
||||
let expected = FunctionCallOutputPayload {
|
||||
body: FunctionCallOutputBody::Text(
|
||||
serde_json::to_string(&vec![text_block("alpha")]).unwrap(),
|
||||
|
||||
Reference in New Issue
Block a user