list_enabled_docs
Retrieve a list of all enabled documents along with their cache status to check availability and caching.
Instructions
List all enabled docs with their cache status
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| verbose | No | Whether to show detailed information |
Implementation Reference
- src/index.ts:585-606 (handler)Handler for the 'list_enabled_docs' tool. Reads config, filters enabled docs, and returns their names along with cache status (verbose or compact).
case "list_enabled_docs": { // Ensure config file exists before reading it await ensureConfigFile(); const verbose = Boolean(request.params.arguments?.verbose); const config = await fs.readJson(configPath); const enabledDocs = docs.filter(doc => docConfig[doc.name]); const result = enabledDocs.map(doc => { const crawledAt = config.crawledDocs?.[doc.name] || "Not crawled"; return verbose ? `${doc.name} (Enabled)\n Start URL: ${doc.crawlerStart}\n Last crawled: ${crawledAt}` : `${doc.name} [${crawledAt === "Not crawled" ? "Not cached" : "Cached"}]`; }); return { content: [{ type: "text", text: result.join("\n") || "No enabled docs found" }] }; } - src/index.ts:503-515 (registration)Registration of the 'list_enabled_docs' tool in the ListToolsRequestSchema handler, defining its name, description, and input schema.
name: "list_enabled_docs", description: "List all enabled docs with their cache status", inputSchema: { type: "object", properties: { verbose: { type: "boolean", description: "Whether to show detailed information", default: false } } } }, - src/index.ts:64-77 (helper)Helper function called by the handler to ensure the config file exists before reading it.
async function ensureConfigFile(): Promise<void> { try { if (!(await fs.pathExists(configPath))) { await fs.ensureDir(docDir); await fs.writeJson(configPath, { enabledDocs: {}, crawledDocs: {} }, { spaces: 2 }); console.log(`Created empty config file at ${configPath}`); } } catch (error) { console.error('Failed to create config file:', error); } } - src/index.ts:82-93 (helper)Helper function that loads the doc config from the file into the global docConfig variable, used by the handler to determine which docs are enabled.
async function loadDocConfig(): Promise<void> { try { // Ensure config file exists before trying to load it await ensureConfigFile(); const config = await fs.readJson(configPath); docConfig = config.enabledDocs || {}; } catch (error) { console.error('Failed to load doc config:', error); docConfig = {}; } }