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

Method write

cli/src/mcp/cache.ts:74–88  ·  view source on GitHub ↗
(value: { endpoint: string; sessionId?: string; tools?: ListedTool[] })

Source from the content-addressed store, hash-verified

72 }
73
74 async write(value: { endpoint: string; sessionId?: string; tools?: ListedTool[] }): Promise<LearnSessionCacheValue> {
75 const normalizedEndpoint = normalizeEndpoint(value.endpoint);
76 const cache = await this.readCacheFile();
77 const storedValue: LearnSessionCacheValue = {
78 endpoint: normalizedEndpoint,
79 sessionId: value.sessionId,
80 tools: value.tools ? [...value.tools] : undefined,
81 updatedAt: new Date(this.now()).toISOString(),
82 expiresAt: new Date(this.now() + this.ttlMs).toISOString(),
83 };
84
85 cache.entries[normalizedEndpoint] = storedValue;
86 await this.writeCacheFile(cache);
87 return storedValue;
88 }
89
90 async clear(endpoint: string): Promise<void> {
91 const normalizedEndpoint = normalizeEndpoint(endpoint);

Callers

nothing calls this directly

Calls 3

readCacheFileMethod · 0.95
writeCacheFileMethod · 0.95
normalizeEndpointFunction · 0.85

Tested by

no test coverage detected