MCPcopy Create free account
hub / github.com/cloudflare/mcp / getProducts

Function getProducts

src/isolate-cache.ts:79–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77
78/** The product list backing the `search` tool description. Empty if unseeded. */
79export async function getProducts(): Promise<string[]> {
80 const now = Date.now()
81 if (fresh(productsEntry, now)) return productsEntry.value
82
83 const obj = await env.SPEC_BUCKET.get('products.json')
84 const value: string[] = obj ? await obj.json() : []
85 productsEntry = { value, expiresAt: now + TTL_MS }
86 return value
87}
88
89/** Drop cached artifacts. For tests that re-seed R2 between cases. */
90export function resetIsolateCache(): void {

Callers 1

registerSearchToolFunction · 0.90

Calls 3

freshFunction · 0.85
jsonMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected