Inspect ISM MCP storage
cache_infoRetrieve offline and user cache directory paths, sizes, file counts, and offline mode status for ISM data.
Instructions
Reports the bundled offline data directory, the writable user cache directory, sizes, file counts, and whether the server is running in offline mode (ISM_MCP_OFFLINE).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/sources.ts:338-391 (handler)The core implementation of getCacheInfo() - reads disk cache and bundled data directories, calculates sizes and entry counts, and returns diagnostic info about the ISM MCP storage.
export async function getCacheInfo(): Promise<{ cacheDir: string; cacheBytes: number; cacheEntries: number; bundleDir: string; bundleEntries: number; bundleBytes: number; bundleAvailable: boolean; bundledVersions: number; offline: boolean; }> { await ensureCacheDir(); const files = await readdir(CACHE_DIR); let cacheBytes = 0; for (const f of files) { const s = await stat(join(CACHE_DIR, f)); cacheBytes += s.size; } let bundleEntries = 0; let bundleBytes = 0; let bundleAvailable = false; let bundledVersions = 0; if (existsSync(BUNDLED_DIR)) { bundleAvailable = true; const idx = await loadBundleIndex(); bundledVersions = idx?.versions.length ?? 0; const versionsDir = join(BUNDLED_DIR, "versions"); if (existsSync(versionsDir)) { const tags = await readdir(versionsDir); for (const t of tags) { const tagDir = join(versionsDir, t); const inner = await readdir(tagDir); for (const f of inner) { const s = await stat(join(tagDir, f)); bundleEntries += 1; bundleBytes += s.size; } } } } return { cacheDir: CACHE_DIR, cacheBytes, cacheEntries: files.length, bundleDir: BUNDLED_DIR, bundleEntries, bundleBytes, bundleAvailable, bundledVersions, offline: OFFLINE, }; } - src/index.ts:524-542 (registration)Registration of the 'cache_info' tool with MCP server, including schema (inputSchema: {}) and the handler that calls getCacheInfo() and augments results with in-memory cache stats.
server.registerTool( "cache_info", { title: "Inspect ISM MCP storage", description: "Reports the bundled offline data directory, the writable user cache directory, sizes, file counts, and whether the server is running in offline mode (ISM_MCP_OFFLINE).", inputSchema: {}, }, async () => { const info = await getCacheInfo(); return txt({ ...info, memoryCached: { catalogs: CATALOG_DOC_CACHE.size, flat: CATALOG_CACHE.size, }, }); }, ); - src/index.ts:532-542 (handler)The async handler function for the 'cache_info' tool - calls getCacheInfo() from sources.ts and adds memoryCached stats (catalog doc and flat control cache sizes).
async () => { const info = await getCacheInfo(); return txt({ ...info, memoryCached: { catalogs: CATALOG_DOC_CACHE.size, flat: CATALOG_CACHE.size, }, }); }, ); - src/index.ts:526-530 (schema)Input schema for the cache_info tool - accepts no parameters (empty schema), with title and description metadata.
{ title: "Inspect ISM MCP storage", description: "Reports the bundled offline data directory, the writable user cache directory, sizes, file counts, and whether the server is running in offline mode (ISM_MCP_OFFLINE).", inputSchema: {}, - src/index.ts:12-18 (helper)Import of getCacheInfo from ./sources.js, which is the helper function that implements the cache diagnostics logic.
import { getCatalog, getCacheInfo, getProfile, listVersions, resolveVersion, } from "./sources.js";