enable_doc
Enables crawling for a specified document, making its content searchable and indexed.
Instructions
Enable crawling for a specific doc
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the doc to enable |
Implementation Reference
- src/index.ts:539-549 (handler)Handler for the 'enable_doc' tool: sets docConfig[name] to true, persists via saveDocConfig(), and returns a confirmation message.
case "enable_doc": { const name = String(request.params.arguments?.name); docConfig[name] = true; await saveDocConfig(); return { content: [{ type: "text", text: `Enabled doc ${name}` }] }; } - src/index.ts:407-420 (schema)Tool registration and input schema for enable_doc in ListToolsRequestSchema handler.
{ name: "enable_doc", description: "Enable crawling for a specific doc", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the doc to enable" } }, required: ["name"] } }, - src/index.ts:404-531 (registration)Registration of all tools including enable_doc via ListToolsRequestSchema handler.
server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "enable_doc", description: "Enable crawling for a specific doc", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the doc to enable" } }, required: ["name"] } }, { name: "disable_doc", description: "Disable crawling for a specific doc", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the doc to disable" } }, required: ["name"] } }, { name: "crawl_docs", description: "Start crawling enabled docs", inputSchema: { type: "object", properties: { force: { type: "boolean", description: "Whether to force re-crawl all docs, ignoring previous crawl records" } } } }, { name: "build_index", description: "Build search index for docs", inputSchema: { type: "object", properties: { force: { type: "boolean", description: "Whether to force rebuild index" } } } }, { name: "search_docs", description: "Search documentation", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query" }, max_results: { type: "number", description: "Maximum number of results", default: 3 }, doc_name: { type: "string", description: "Filter by document category" }, offset: { type: "number", description: "Number of results to skip", default: 0 } }, required: ["query"] } }, { name: "build_index", description: "Build search index for docs", inputSchema: { type: "object", properties: { force: { type: "boolean", description: "Whether to force rebuild index" } } } }, { 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 } } } }, { name: "list_all_docs", description: "List all available docs including disabled ones", inputSchema: { type: "object", properties: { verbose: { type: "boolean", description: "Whether to show detailed information", default: false } } } } ] }; - src/index.ts:98-113 (helper)Helper function called by enable_doc handler to persist the updated docConfig to disk.
async function saveDocConfig(): Promise<void> { try { const config = { enabledDocs: docConfig, crawledDocs: {} }; if (await fs.pathExists(configPath)) { const existingConfig = await fs.readJson(configPath); config.crawledDocs = existingConfig.crawledDocs || {}; } await fs.ensureDir(docDir); await fs.writeJson(configPath, config, { spaces: 2 }); } catch (error) { console.error('Failed to save doc config:', error); } }