mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[codex][mcp] Add resource uri meta to tool call item. (#17831)
- [x] Add resource uri meta to tool call item so that the app-server client can start prefetching resources immediately without loading mcp server status.
This commit is contained in:
@@ -4759,6 +4759,7 @@ impl ChatWidget {
|
||||
invocation,
|
||||
duration,
|
||||
result,
|
||||
..
|
||||
} = ev;
|
||||
|
||||
let extra_cell = match self
|
||||
@@ -5943,6 +5944,7 @@ impl ChatWidget {
|
||||
server,
|
||||
tool,
|
||||
arguments,
|
||||
mcp_app_resource_uri,
|
||||
result,
|
||||
error,
|
||||
duration_ms,
|
||||
@@ -5955,15 +5957,19 @@ impl ChatWidget {
|
||||
tool,
|
||||
arguments: Some(arguments),
|
||||
},
|
||||
mcp_app_resource_uri,
|
||||
duration: Duration::from_millis(duration_ms.unwrap_or_default().max(0) as u64),
|
||||
result: match (result, error) {
|
||||
(_, Some(error)) => Err(error.message),
|
||||
(Some(result), None) => Ok(codex_protocol::mcp::CallToolResult {
|
||||
content: result.content,
|
||||
structured_content: result.structured_content,
|
||||
is_error: Some(false),
|
||||
meta: None,
|
||||
}),
|
||||
(Some(result), None) => {
|
||||
let result = *result;
|
||||
Ok(codex_protocol::mcp::CallToolResult {
|
||||
content: result.content,
|
||||
structured_content: result.structured_content,
|
||||
is_error: Some(false),
|
||||
meta: None,
|
||||
})
|
||||
}
|
||||
(None, None) => Err("MCP tool call completed without a result".to_string()),
|
||||
},
|
||||
});
|
||||
@@ -6453,6 +6459,7 @@ impl ChatWidget {
|
||||
server,
|
||||
tool,
|
||||
arguments,
|
||||
mcp_app_resource_uri,
|
||||
..
|
||||
} => {
|
||||
self.on_mcp_tool_call_begin(McpToolCallBeginEvent {
|
||||
@@ -6462,6 +6469,7 @@ impl ChatWidget {
|
||||
tool,
|
||||
arguments: Some(arguments),
|
||||
},
|
||||
mcp_app_resource_uri,
|
||||
});
|
||||
}
|
||||
ThreadItem::WebSearch { id, .. } => {
|
||||
|
||||
Reference in New Issue
Block a user