mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
Expose MCP provenance to tool lifecycle extensions (#40976)
## What changed - Add optional `McpToolContext` metadata to `ToolStartInput`, exposing the model-visible MCP tool details and its source classification without exposing the executable client. - Classify MCP calls as connectors, configured servers, plugin servers, executor-selected plugins, or other registrations based on the prepared call. - Prepare each MCP call before notifying tool lifecycle contributors and reuse that same call for execution so the callback describes the call that runs. ## Testing - Cover host-owned connector calls and extension-owned Apps server calls, including their distinct provenance and executed tool names. GitOrigin-RevId: efd23f511b1045ffdd96349d621ad62365569b2b
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use codex_extension_api::McpToolContext;
|
||||
use codex_extension_api::ToolCallOutcome;
|
||||
use codex_extension_api::ToolCallSource as ExtensionToolCallSource;
|
||||
use codex_extension_api::ToolFinishInput;
|
||||
@@ -11,7 +12,10 @@ use crate::session::turn_context::TurnContext;
|
||||
use crate::tools::context::ToolCallSource;
|
||||
use crate::tools::context::ToolInvocation;
|
||||
|
||||
pub(crate) async fn notify_tool_start(invocation: &ToolInvocation) {
|
||||
pub(crate) async fn notify_tool_start(
|
||||
invocation: &ToolInvocation,
|
||||
mcp_tool: Option<&McpToolContext>,
|
||||
) {
|
||||
let contributors = invocation
|
||||
.session
|
||||
.services
|
||||
@@ -32,6 +36,7 @@ pub(crate) async fn notify_tool_start(invocation: &ToolInvocation) {
|
||||
turn_id: invocation.turn.sub_id.as_str(),
|
||||
call_id: invocation.call_id.as_str(),
|
||||
tool_name: &invocation.tool_name,
|
||||
mcp_tool,
|
||||
payload: &invocation.payload,
|
||||
conversation_history: Arc::clone(&conversation_history),
|
||||
source: extension_tool_call_source(invocation.source.clone()),
|
||||
|
||||
Reference in New Issue
Block a user