enable_doc
Activate crawling for a specific document to make its content searchable and accessible within the document management system.
Instructions
Enable crawling for a specific doc
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the doc to enable |
Implementation Reference
- src/index.ts:539-549 (handler)The handler for the 'enable_doc' tool. It extracts the doc name from arguments, sets it as enabled in the global docConfig, saves the config to file, and returns a success 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 (registration)Registration of the 'enable_doc' tool in the ListToolsRequestSchema handler. Includes the tool name, description, and input schema definition requiring a 'name' string.{ 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:410-418 (schema)Input schema for the 'enable_doc' tool, defining an object with a required 'name' string property.inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the doc to enable" } }, required: ["name"]
- src/index.ts:98-113 (helper)Helper function called by the enable_doc handler to persist the updated docConfig to the JSON config file, preserving existing crawledDocs data.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); } }