mirror of
https://github.com/openai/codex.git
synced 2026-11-18 23:02:23 +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
@@ -79,6 +79,9 @@ pub struct McpServerStatus {
|
||||
pub plugin_id: Option<String>,
|
||||
pub server_info: Option<McpServerInfo>,
|
||||
pub tools: std::collections::HashMap<String, McpTool>,
|
||||
/// Tool discovery failed and no catalog was returned.
|
||||
/// Null when a catalog is returned, including cached or empty catalogs.
|
||||
pub tools_error: Option<String>,
|
||||
pub resources: Vec<McpResource>,
|
||||
pub resource_templates: Vec<McpResourceTemplate>,
|
||||
pub auth_status: McpAuthStatus,
|
||||
|
||||
@@ -2578,6 +2578,7 @@ fn mcp_server_elicitation_response_serializes_nullable_content() {
|
||||
fn mcp_server_status_serializes_absent_server_info_as_null() {
|
||||
let response = ListMcpServerStatusResponse {
|
||||
data: vec![McpServerStatus {
|
||||
tools_error: None,
|
||||
name: "not-ready".to_string(),
|
||||
runtime_status: None,
|
||||
plugin_id: None,
|
||||
@@ -2599,6 +2600,7 @@ fn mcp_server_status_serializes_absent_server_info_as_null() {
|
||||
"pluginId": null,
|
||||
"serverInfo": null,
|
||||
"tools": {},
|
||||
"toolsError": null,
|
||||
"resources": [],
|
||||
"resourceTemplates": [],
|
||||
"authStatus": "unknown",
|
||||
@@ -2623,6 +2625,7 @@ fn mcp_server_status_accepts_older_inventory_without_runtime_status() {
|
||||
assert_eq!(
|
||||
status,
|
||||
McpServerStatus {
|
||||
tools_error: None,
|
||||
name: "older-server".to_string(),
|
||||
runtime_status: None,
|
||||
plugin_id: None,
|
||||
@@ -2694,6 +2697,7 @@ fn mcp_server_status_updated_serializes_failure_reason() {
|
||||
fn mcp_server_status_serializes_absent_server_info_metadata_as_null() {
|
||||
let response = ListMcpServerStatusResponse {
|
||||
data: vec![McpServerStatus {
|
||||
tools_error: None,
|
||||
name: "initialized".to_string(),
|
||||
runtime_status: None,
|
||||
plugin_id: Some("lookup@test".to_string()),
|
||||
@@ -2729,6 +2733,7 @@ fn mcp_server_status_serializes_absent_server_info_metadata_as_null() {
|
||||
"websiteUrl": null,
|
||||
},
|
||||
"tools": {},
|
||||
"toolsError": null,
|
||||
"resources": [],
|
||||
"resourceTemplates": [],
|
||||
"authStatus": "unsupported",
|
||||
|
||||
Reference in new issue
Block a user