mirror of
https://github.com/openai/codex.git
synced 2026-11-23 15:18:14 +00:00
Report MCP tool discovery errors in server status (#42598)
## Why An empty tool map does not distinguish a successfully returned empty catalog from a server whose startup or tool discovery failed. ## What changed - Add nullable `toolsError` to each `mcpServerStatus/list` entry when no catalog is available because startup or tool discovery failed. - Keep `toolsError` null for returned catalogs, including cached and empty catalogs, and continue returning healthy servers when another server fails. - Update the protocol schemas and generated TypeScript type. ## Testing - Extend the app-server status integration test with a broken MCP server and verify its error without losing the healthy server's inventory. GitOrigin-RevId: 30b4ca4d9a45cec6998f5f626d3fddbee90a525d
This commit is contained in:
1 parent
f60dfe80b5
commit
8f31b64c7f
19 files changed
+108
-30
No files matched your search
@@ -459,6 +459,7 @@ pub async fn read_mcp_resource(
|
||||
pub struct McpServerStatusSnapshot {
|
||||
pub server_infos: HashMap<String, McpServerInfo>,
|
||||
pub tools_by_server: HashMap<String, HashMap<String, Tool>>,
|
||||
pub tools_errors: HashMap<String, String>,
|
||||
pub resources: HashMap<String, Vec<Resource>>,
|
||||
pub resource_templates: HashMap<String, Vec<ResourceTemplate>>,
|
||||
pub auth_statuses: HashMap<String, McpAuthStatus>,
|
||||
@@ -479,6 +480,7 @@ pub async fn collect_mcp_server_status_snapshot_with_detail(
|
||||
return McpServerStatusSnapshot {
|
||||
server_infos: HashMap::new(),
|
||||
tools_by_server: HashMap::new(),
|
||||
tools_errors: HashMap::new(),
|
||||
resources: HashMap::new(),
|
||||
resource_templates: HashMap::new(),
|
||||
auth_statuses: HashMap::new(),
|
||||
@@ -761,10 +763,10 @@ async fn collect_mcp_server_status_snapshot_from_manager(
|
||||
server_names: Vec<String>,
|
||||
detail: McpSnapshotDetail,
|
||||
) -> McpServerStatusSnapshot {
|
||||
let ((server_infos, tools), resources, resource_templates) = tokio::join!(
|
||||
let ((server_infos, (tools, tools_errors)), resources, resource_templates) = tokio::join!(
|
||||
async {
|
||||
let server_infos = mcp_connection_manager.list_available_server_infos().await;
|
||||
let tools = mcp_connection_manager.list_all_tools().await;
|
||||
let tools = mcp_connection_manager.list_tools_with_errors().await;
|
||||
(server_infos, tools)
|
||||
},
|
||||
async {
|
||||
@@ -801,6 +803,7 @@ async fn collect_mcp_server_status_snapshot_from_manager(
|
||||
McpServerStatusSnapshot {
|
||||
server_infos,
|
||||
tools_by_server,
|
||||
tools_errors,
|
||||
resources: convert_mcp_resources(resources),
|
||||
resource_templates: convert_mcp_resource_templates(resource_templates),
|
||||
auth_statuses: auth_statuses_from_entries(&auth_status_entries),
|
||||
|
||||
Reference in new issue
Block a user