Reuse McpToolOutput in McpHandler (#14229)

We already have a type to represent the MCP tool output, reuse it
instead of the custom McpHandlerOutput
This commit is contained in:
pakrym-oai
2026-03-10 10:41:41 -07:00
committed by GitHub
parent 77a02909a8
commit 46e6661d4e
8 changed files with 119 additions and 141 deletions

View File

@@ -58,6 +58,7 @@ 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;
@@ -1607,7 +1608,7 @@ fn prefers_structured_content_when_present() {
meta: None,
};
let got = FunctionCallOutputPayload::from(&ctr);
let got = McpToolOutput::from(&ctr).into_function_call_output_payload();
let expected = FunctionCallOutputPayload {
body: FunctionCallOutputBody::Text(
serde_json::to_string(&json!({
@@ -1689,7 +1690,7 @@ fn falls_back_to_content_when_structured_is_null() {
meta: None,
};
let got = FunctionCallOutputPayload::from(&ctr);
let got = McpToolOutput::from(&ctr).into_function_call_output_payload();
let expected = FunctionCallOutputPayload {
body: FunctionCallOutputBody::Text(
serde_json::to_string(&vec![text_block("hello"), text_block("world")]).unwrap(),
@@ -1709,7 +1710,7 @@ fn success_flag_reflects_is_error_true() {
meta: None,
};
let got = FunctionCallOutputPayload::from(&ctr);
let got = McpToolOutput::from(&ctr).into_function_call_output_payload();
let expected = FunctionCallOutputPayload {
body: FunctionCallOutputBody::Text(
serde_json::to_string(&json!({ "message": "bad" })).unwrap(),
@@ -1729,7 +1730,7 @@ fn success_flag_true_with_no_error_and_content_used() {
meta: None,
};
let got = FunctionCallOutputPayload::from(&ctr);
let got = McpToolOutput::from(&ctr).into_function_call_output_payload();
let expected = FunctionCallOutputPayload {
body: FunctionCallOutputBody::Text(
serde_json::to_string(&vec![text_block("alpha")]).unwrap(),