MCPcopy Create free account
hub / github.com/MicrosoftDocs/mcp / loadPersistentCache

Method loadPersistentCache

cli/src/mcp/client.ts:312–337  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

310 }
311
312 private async loadPersistentCache(): Promise<void> {
313 if (this.hasLoadedPersistentCache) {
314 return;
315 }
316
317 const cachedValue = await this.cacheStore.read(this.endpoint.toString());
318 this.hasLoadedPersistentCache = true;
319
320 if (!cachedValue) {
321 return;
322 }
323
324 this.cachedSessionId = cachedValue.sessionId;
325
326 if (!cachedValue.tools || cachedValue.tools.length === 0) {
327 return;
328 }
329
330 this.cachedTools = [...cachedValue.tools];
331
332 try {
333 this.discoveredTools = discoverLearnTools(this.cachedTools);
334 } catch {
335 this.discoveredTools = undefined;
336 }
337 }
338
339 private async persistCache(): Promise<void> {
340 const sessionId = this.transport?.sessionId ?? this.cachedSessionId;

Callers 2

getToolMappingMethod · 0.95
ensureConnectedMethod · 0.95

Calls 2

discoverLearnToolsFunction · 0.85
readMethod · 0.65

Tested by

no test coverage detected