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:
pakrym-oai
2026-03-11 12:33:08 -07:00
committed by Michael Bolin
parent d5694529ca
commit ee8f84153e
12 changed files with 659 additions and 137 deletions
+2 -2
View File
@@ -622,7 +622,7 @@ impl JsReplManager {
}
ResponseInputItem::McpToolCallOutput { output, .. } => {
let function_output = output.as_function_call_output_payload();
let payload_kind = if output.success {
let payload_kind = if output.success() {
JsReplToolCallPayloadKind::McpResult
} else {
JsReplToolCallPayloadKind::McpErrorResult
@@ -634,7 +634,7 @@ impl JsReplManager {
);
summary.payload_item_count = Some(output.content.len());
summary.structured_content_present = Some(output.structured_content.is_some());
summary.result_is_error = Some(!output.success);
summary.result_is_error = Some(!output.success());
summary
}
}