You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(client): minimal response-cache substrate; list* auto-paginate and write one cached entry
ResponseCacheStore / InMemoryResponseCacheStore (new file responseCache.ts)
back the Client's derived views: a no-argument listTools / listPrompts /
listResources / listResourceTemplates call walks every page and writes ONE
aggregated entry; explicit-cursor calls still pass through. list_changed
notifications evict the matching method (no refetch); _resetConnectionState
clears the store. _toolDefinition(name) is the derived name->Tool view over
the cached tools/list entry, memoized against the entry's stamp (mcp.d's
cachedTool pattern).
New ClientOptions: responseCacheStore (defaults to a fresh per-instance
InMemoryResponseCacheStore — a store MUST NOT be shared across clients with
different auth contexts; entries are keyed by method only) and listMaxPages
(auto-pagination cap, default 64).
The e2e *:list:pagination 'raw server' bodies and pagination:client:
cursor-handling are rewritten to assert the aggregated result and the
verbatim wire-level cursor walk; the 'mcpserver' bodies are unchanged (still
knownFailure — McpServer does not paginate server-side).
Response-cache substrate. `Client` now holds a pluggable `ResponseCacheStore` (default: a fresh per-instance `InMemoryResponseCacheStore`) that the four `list*` verbs write their aggregated result to and that `*/list_changed` notifications evict. A no-argument `listTools()` / `listPrompts()` / `listResources()` / `listResourceTemplates()` call now walks every page internally and returns the aggregated list (`nextCursor: undefined`); explicit-cursor calls still return one page. The cached `tools/list` entry is the single source for the existing output-schema validators and (on a 2026-07-28 connection) SEP-2243 `Mcp-Param-*` mirroring. New exports: `ResponseCacheStore`, `CacheKey`, `CacheEntry`, `CacheScope`, `MaybePromise`, `InMemoryResponseCacheStore`; new `ClientOptions.responseCacheStore` / `ClientOptions.listMaxPages`. The store interface is async-ready (`MaybePromise<…>`); the in-memory default stays synchronous. **A store instance must not be shared across `Client` instances at all in v2.0.x** — entries are keyed by method only (server-identity confusion + `clear()`/`evict()` cross-talk); per-principal partitioning that enables safe sharing arrives with the full caching engine.
Copy file name to clipboardExpand all lines: docs/migration.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -538,6 +538,14 @@ const result = specTypeSchemas.CallToolResult['~standard'].validate(value);
538
538
`isSpecType` and `specTypeSchemas` are keyed by `SpecTypeName` — a literal union of every named type in the MCP spec — so you get autocomplete and a compile error on typos. `specTypeSchemas.X` is a `StandardSchemaV1Sync<In, Out>` — `validate()` returns the result synchronously,
539
539
so you can access `.issues` / `.value` without `await`. It composes with any Standard-Schema-aware library. The pre-existing `isCallToolResult(value)` guard still works.
540
540
541
+
### Client list methods auto-paginate and feed the response cache
542
+
543
+
A no-argument `Client.listTools()` / `listPrompts()` / `listResources()` / `listResourceTemplates()` call now walks every page internally and returns the aggregated list (`nextCursor` is `undefined`). Explicit-cursor calls (`listTools({ cursor })`) still return one page, so the
544
+
documented cursor loop continues to work — it just iterates once. The aggregated result is written to a per-client response cache (`ResponseCacheStore`, default `InMemoryResponseCacheStore`); a `*/list_changed` notification evicts the matching entry, and a reconnect clears the
545
+
per-instance default store (a user-supplied store is left untouched). The cached `tools/list` entry is what `callTool`'s output validation and (on a 2026-07-28 connection) SEP-2243 `Mcp-Param-*` mirroring read. Pass `ClientOptions.responseCacheStore` to supply your own store —
546
+
**do not share one store across `Client` instances at all in v2.0.x** (server-identity confusion + `clear()`/`evict()` cross-talk; per-principal partitioning that enables safe sharing arrives with the full caching engine). `ClientOptions.listMaxPages` (default `64`) bounds the
547
+
auto-pagination loop.
548
+
541
549
### Client list methods return empty results for missing capabilities
542
550
543
551
`Client.listPrompts()`, `listResources()`, `listResourceTemplates()`, and `listTools()` now return empty results when the server didn't advertise the corresponding capability, instead of sending the request. This respects the MCP spec's capability negotiation.
0 commit comments