docs_generate_structure
Create initial documentation structure and configuration files for projects using Docusaurus, MkDocs, or Sphinx frameworks.
Instructions
Generate documentation scaffold/structure based on project analysis. Creates initial directory structure and configuration files.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Path to the project directory | |
| framework | Yes | Documentation framework to use | |
| template | No | Template to use (for Docusaurus: classic, facebook, etc.) | |
| outputPath | No | Output path for documentation (default: ./docs) |
Implementation Reference
- src/tools/generateStructure.ts:10-29 (handler)The main handler function for the 'docs_generate_structure' tool. It parses arguments and dispatches to framework-specific generators (Docusaurus, MkDocs, Sphinx).export async function generateStructure(args: any) { const { projectPath, framework, template, outputPath = "docs" } = args as GenerateStructureArgs; try { const fullOutputPath = path.resolve(projectPath, outputPath); switch (framework) { case "docusaurus": return await generateDocusaurus(projectPath, fullOutputPath, template); case "mkdocs": return await generateMkDocs(projectPath, fullOutputPath); case "sphinx": return await generateSphinx(projectPath, fullOutputPath); default: throw new Error(`Unsupported framework: ${framework}`); } } catch (error) { throw new Error(`Failed to generate structure: ${error}`); } }
- src/index.ts:57-83 (schema)Input schema definition for the 'docs_generate_structure' tool, including properties and requirements.{ name: "docs_generate_structure", description: "Generate documentation scaffold/structure based on project analysis. Creates initial directory structure and configuration files.", inputSchema: { type: "object", properties: { projectPath: { type: "string", description: "Path to the project directory", }, framework: { type: "string", description: "Documentation framework to use", enum: ["docusaurus", "mkdocs", "sphinx"], }, template: { type: "string", description: "Template to use (for Docusaurus: classic, facebook, etc.)", }, outputPath: { type: "string", description: "Output path for documentation (default: ./docs)", }, }, required: ["projectPath", "framework"], }, },
- src/index.ts:302-303 (registration)Tool handler registration in the switch statement for CallToolRequestSchema.case "docs_generate_structure": return await generateStructure(args);
- src/tools/generateStructure.ts:31-66 (helper)Helper function generating setup instructions for Docusaurus documentation framework.async function generateDocusaurus(projectPath: string, outputPath: string, template?: string) { const availableTemplates = [ "classic", "facebook", "meta", ]; const selectedTemplate = template && availableTemplates.includes(template) ? template : "classic"; const message = `📦 Docusaurus Setup Instructions: 1. Install Docusaurus: cd ${projectPath} npx create-docusaurus@latest ${path.basename(outputPath)} ${selectedTemplate} --typescript 2. Available templates: ${availableTemplates.map(t => `- ${t}`).join("\n ")} 3. Start the development server: cd ${path.basename(outputPath)} npm start 4. Build for production: npm run build The static files will be in the 'build' directory, ready for hosting!`; return { content: [ { type: "text", text: message, }, ], }; }