[mcp] Support MCP Apps part 3 - Add mcp tool call support. (#17364)

- [x] Add a new app-server method so that MCP Apps can call their own
MCP server directly.
This commit is contained in:
Matthew Zeng
2026-04-10 21:39:19 -07:00
committed by GitHub
Unverified
parent f8bb088617
commit b7139a7e8f
112 changed files with 871 additions and 238 deletions
+14
View File
@@ -9,6 +9,7 @@ use codex_protocol::config_types::Personality;
use codex_protocol::config_types::ServiceTier;
use codex_protocol::error::CodexErr;
use codex_protocol::error::Result as CodexResult;
use codex_protocol::mcp::CallToolResult;
use codex_protocol::models::ContentItem;
use codex_protocol::models::ResponseInputItem;
use codex_protocol::models::ResponseItem;
@@ -224,6 +225,19 @@ impl CodexThread {
Ok(serde_json::to_value(result)?)
}
pub async fn call_mcp_tool(
&self,
server: &str,
tool: &str,
arguments: Option<serde_json::Value>,
meta: Option<serde_json::Value>,
) -> anyhow::Result<CallToolResult> {
self.codex
.session
.call_tool(server, tool, arguments, meta)
.await
}
pub fn enabled(&self, feature: Feature) -> bool {
self.codex.enabled(feature)
}