Skip to main content
Glama

generate_config

Create configuration files for static site generators like Jekyll, Hugo, Docusaurus, MkDocs, or Eleventy to streamline project setup.

Instructions

Generate configuration files for the selected static site generator

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ssgYes
projectNameYes
projectDescriptionNo
outputPathYesWhere to generate config files

Implementation Reference

  • Main handler function for 'generate_config' tool. Validates input with Zod schema, generates SSG-specific configuration files using helper functions, writes them to outputPath, and formats MCP response.
    export async function generateConfig( args: unknown, ): Promise<{ content: any[] }> { const startTime = Date.now(); const { ssg, projectName, projectDescription, outputPath } = inputSchema.parse(args); try { // Ensure output directory exists await fs.mkdir(outputPath, { recursive: true }); let configFiles: Array<{ path: string; content: string }> = []; switch (ssg) { case "docusaurus": configFiles = await generateDocusaurusConfig( projectName, projectDescription || "", ); break; case "mkdocs": configFiles = await generateMkDocsConfig( projectName, projectDescription || "", ); break; case "hugo": configFiles = await generateHugoConfig( projectName, projectDescription || "", ); break; case "jekyll": configFiles = await generateJekyllConfig( projectName, projectDescription || "", ); break; case "eleventy": configFiles = await generateEleventyConfig( projectName, projectDescription || "", ); break; } // Write all config files for (const file of configFiles) { const filePath = path.join(outputPath, file.path); await fs.mkdir(path.dirname(filePath), { recursive: true }); await fs.writeFile(filePath, file.content); } const configResult = { ssg, projectName, projectDescription, outputPath, filesCreated: configFiles.map((f) => f.path), totalFiles: configFiles.length, }; const response: MCPToolResponse<typeof configResult> = { success: true, data: configResult, metadata: { toolVersion: "1.0.0", executionTime: Date.now() - startTime, timestamp: new Date().toISOString(), }, recommendations: [ { type: "info", title: "Configuration Complete", description: `Generated ${configFiles.length} configuration files for ${ssg}`, }, ], nextSteps: [ { action: "Setup Documentation Structure", toolRequired: "setup_structure", description: `Create Diataxis-compliant documentation structure`, priority: "high", }, ], }; return formatMCPResponse(response); } catch (error) { const errorResponse: MCPToolResponse = { success: false, error: { code: "CONFIG_GENERATION_FAILED", message: `Failed to generate config: ${error}`, resolution: "Ensure output path is writable and SSG type is supported", }, metadata: { toolVersion: "1.0.0", executionTime: Date.now() - startTime, timestamp: new Date().toISOString(), }, }; return formatMCPResponse(errorResponse); } }
  • Zod input schema defining parameters for SSG type, project details, and output path.
    const inputSchema = z.object({ ssg: z.enum(["jekyll", "hugo", "docusaurus", "mkdocs", "eleventy"]), projectName: z.string(), projectDescription: z.string().optional(), outputPath: z.string(), });
  • Helper functions like generateDocusaurusConfig, generateMkDocsConfig, etc., that return arrays of {path, content} for specific SSG configurations.
    } async function generateDocusaurusConfig(

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tosin2013/documcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server