mirror of
https://github.com/openai/codex.git
synced 2026-11-14 14:49:31 +00:00
Expose advertised MCP server capabilities in status responses (#44826)
## What changed Add `serverCapabilities` to `mcpServerStatus/list` responses in both `full` and `toolsAndAuthOnly` modes, including thread-scoped reads. Return the initialized server's capabilities object, including its `extensions` map, or `null` when unavailable. Capture capabilities during initialization so they remain available when tool discovery fails. Clear them on each new connection attempt and keep them independent of shared tool caches. Update the protocol schemas, generated TypeScript and Python types, and documentation. ## Testing Add coverage for extension capabilities surviving tool-discovery failures in both detail modes. Extend existing tests to check advertised extensions, absent capabilities after initialization failure, and serialization of unavailable capabilities as `null`. GitOrigin-RevId: 8e9d67c10fac3a54e82bef8be5d99caaf82597d1
This commit is contained in:
1 parent
624ccf7947
commit
7a6f469dcf
20 files changed
+199
-9
No files matched your search
@@ -79,6 +79,8 @@ pub struct McpServerStatus {
|
||||
pub runtime_status: Option<McpServerConnectionStatus>,
|
||||
pub plugin_id: Option<String>,
|
||||
pub server_info: Option<McpServerInfo>,
|
||||
/// Capabilities advertised by the initialized MCP server; null when unavailable.
|
||||
pub server_capabilities: Option<serde_json::Value>,
|
||||
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.
|
||||
|
||||
@@ -2581,6 +2581,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 {
|
||||
server_capabilities: None,
|
||||
tools_error: None,
|
||||
name: "not-ready".to_string(),
|
||||
runtime_status: None,
|
||||
@@ -2602,6 +2603,7 @@ fn mcp_server_status_serializes_absent_server_info_as_null() {
|
||||
"runtimeStatus": null,
|
||||
"pluginId": null,
|
||||
"serverInfo": null,
|
||||
"serverCapabilities": null,
|
||||
"tools": {},
|
||||
"toolsError": null,
|
||||
"resources": [],
|
||||
@@ -2628,6 +2630,7 @@ fn mcp_server_status_accepts_older_inventory_without_runtime_status() {
|
||||
assert_eq!(
|
||||
status,
|
||||
McpServerStatus {
|
||||
server_capabilities: None,
|
||||
tools_error: None,
|
||||
name: "older-server".to_string(),
|
||||
runtime_status: None,
|
||||
@@ -2700,6 +2703,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 {
|
||||
server_capabilities: None,
|
||||
tools_error: None,
|
||||
name: "initialized".to_string(),
|
||||
runtime_status: None,
|
||||
@@ -2727,6 +2731,7 @@ fn mcp_server_status_serializes_absent_server_info_metadata_as_null() {
|
||||
"name": "initialized",
|
||||
"runtimeStatus": null,
|
||||
"pluginId": "lookup@test",
|
||||
"serverCapabilities": null,
|
||||
"serverInfo": {
|
||||
"name": "lookup-server",
|
||||
"title": null,
|
||||
|
||||
Reference in new issue
Block a user