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

Method read

cli/src/mcp/cache.ts:56–72  ·  view source on GitHub ↗
(endpoint: string)

Source from the content-addressed store, hash-verified

54 }
55
56 async read(endpoint: string): Promise<LearnSessionCacheValue | undefined> {
57 const normalizedEndpoint = normalizeEndpoint(endpoint);
58 const cache = await this.readCacheFile();
59 const entry = cache.entries[normalizedEndpoint];
60
61 if (!entry) {
62 return undefined;
63 }
64
65 if (new Date(entry.expiresAt).getTime() <= this.now()) {
66 delete cache.entries[normalizedEndpoint];
67 await this.writeCacheFile(cache);
68 return undefined;
69 }
70
71 return entry;
72 }
73
74 async write(value: { endpoint: string; sessionId?: string; tools?: ListedTool[] }): Promise<LearnSessionCacheValue> {
75 const normalizedEndpoint = normalizeEndpoint(value.endpoint);

Callers

nothing calls this directly

Calls 3

readCacheFileMethod · 0.95
writeCacheFileMethod · 0.95
normalizeEndpointFunction · 0.85

Tested by

no test coverage detected