feat: migrate MCP implementation from mcp-types to rmcp

This commit is contained in:
Michael Bolin
2026-02-02 11:10:40 -08:00
parent 0b460eda32
commit 99abcc3945
92 changed files with 1629 additions and 8273 deletions
@@ -375,7 +375,8 @@ impl EventProcessor for EventProcessorWithHumanOutput {
ts_msg!(self, "{}", title.style(title_style));
if let Ok(res) = result {
let val: serde_json::Value = res.into();
let val = serde_json::to_value(res)
.unwrap_or_else(|_| serde_json::Value::String("<result>".to_string()));
let pretty =
serde_json::to_string_pretty(&val).unwrap_or_else(|_| val.to_string());
+8 -2
View File
@@ -1,5 +1,4 @@
use codex_protocol::models::WebSearchAction;
use mcp_types::ContentBlock as McpContentBlock;
use serde::Deserialize;
use serde::Serialize;
use serde_json::Value as JsonValue;
@@ -256,7 +255,14 @@ pub struct CollabToolCallItem {
/// Result payload produced by an MCP tool invocation.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, TS)]
pub struct McpToolCallItemResult {
pub content: Vec<McpContentBlock>,
// NOTE: `rmcp::model::Content` (and its `RawContent` variants) would be a
// more precise Rust representation of MCP content blocks. We intentionally
// use `serde_json::Value` here because this crate exports JSON schema + TS
// types (`schemars`/`ts-rs`), and the rmcp model types aren't set up to be
// schema/TS friendly (and would introduce heavier coupling to rmcp's Rust
// representations). Using `JsonValue` keeps the payload wire-shaped and
// easy to export.
pub content: Vec<JsonValue>,
pub structured_content: Option<JsonValue>,
}