Preserve MCP tool-list metadata in server status (#54686)

## Why

MCP tool discovery discarded response-level `_meta`, leaving server-status clients unable to inspect metadata associated with the tool catalog.

## What changed

- Preserve opaque `_meta` from the first `tools/list` page through catalog refreshes and caches.
- Expose it as `toolListMeta` in `McpServerStatus`, with `null` when unavailable, and update generated schemas and bindings.
- Scope cached Apps catalog metadata to discovery settings, including client capabilities and extensions, while retaining tools from older caches without metadata.
- Restrict server capabilities in status snapshots to the selected servers.

## Testing

Add regression coverage for listing legacy cached Apps tools during failed startup, and update protocol serialization expectations for nullable `toolListMeta`.

GitOrigin-RevId: 62335e2fd8c482067a7a78a7612b58c3eaa9fb55
This commit is contained in:
victor-openai
2026-10-16 19:26:46 +00:00
committed by copyberry
parent 440312f113
commit 0e67502123
27 changed files with 428 additions and 128 deletions
@@ -8839,6 +8839,13 @@ class McpServerStatus(BaseModel):
),
] = None
server_info: Annotated[McpServerInfo | None, Field(alias="serverInfo")] = None
tool_list_meta: Annotated[
Any | None,
Field(
alias="toolListMeta",
description="Opaque `_meta` from the first page of the corresponding MCP tool catalog. Null when unavailable.",
),
] = None
tools: dict[str, Tool]
tools_error: Annotated[
str | None,