Skip to main content
Glama

setup_structure

Create a Diataxis-compliant documentation structure for static site generators by specifying the root path and SSG type.

Instructions

Create Diataxis-compliant documentation structure

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesRoot path for documentation
ssgYes
includeExamplesNo

Implementation Reference

  • Zod schema for input validation: path (string), ssg (enum of static site generators), includeExamples (boolean, optional, default true).
    const inputSchema = z.object({
      path: z.string(),
      ssg: z.enum(["jekyll", "hugo", "docusaurus", "mkdocs", "eleventy"]),
      includeExamples: z.boolean().optional().default(true),
    });
  • Core handler function that validates input with schema, creates Diataxis-compliant documentation structure (tutorials, how-to, reference, explanation directories with index.md and optional examples), generates frontmatter/content based on SSG, and returns formatted MCPToolResponse with results, recommendations, and nextSteps.
    export async function setupStructure(
      args: unknown,
    ): Promise<{ content: any[] }> {
      const startTime = Date.now();
      const { path: docsPath, ssg, includeExamples } = inputSchema.parse(args);
    
      try {
        const createdDirs: string[] = [];
        const createdFiles: string[] = [];
    
        // Create base docs directory
        await fs.mkdir(docsPath, { recursive: true });
    
        // Create Diataxis structure
        for (const [category, info] of Object.entries(DIATAXIS_STRUCTURE)) {
          const categoryPath = path.join(docsPath, category);
          await fs.mkdir(categoryPath, { recursive: true });
          createdDirs.push(categoryPath);
    
          // Create index file for category
          const indexPath = path.join(categoryPath, "index.md");
          const indexContent = generateCategoryIndex(
            category,
            info.description,
            ssg,
            includeExamples,
          );
          await fs.writeFile(indexPath, indexContent);
          createdFiles.push(indexPath);
    
          // Create example content if requested
          if (includeExamples) {
            const examplePath = path.join(categoryPath, info.example);
            const exampleContent = generateExampleContent(
              category,
              info.example,
              ssg,
            );
            await fs.writeFile(examplePath, exampleContent);
            createdFiles.push(examplePath);
          }
        }
    
        // Create root index
        const rootIndexPath = path.join(docsPath, "index.md");
        const rootIndexContent = generateRootIndex(ssg);
        await fs.writeFile(rootIndexPath, rootIndexContent);
        createdFiles.push(rootIndexPath);
    
        const structureResult = {
          docsPath,
          ssg,
          includeExamples,
          directoriesCreated: createdDirs,
          filesCreated: createdFiles,
          diataxisCategories: Object.keys(DIATAXIS_STRUCTURE),
          totalDirectories: createdDirs.length,
          totalFiles: createdFiles.length,
        };
    
        const response: MCPToolResponse<typeof structureResult> = {
          success: true,
          data: structureResult,
          metadata: {
            toolVersion: "1.0.0",
            executionTime: Date.now() - startTime,
            timestamp: new Date().toISOString(),
          },
          recommendations: [
            {
              type: "info",
              title: "Diataxis Structure Created",
              description: `Successfully created ${createdDirs.length} directories and ${createdFiles.length} files`,
            },
          ],
          nextSteps: [
            {
              action: "Generate Sitemap",
              toolRequired: "manage_sitemap",
              description:
                "Create sitemap.xml as source of truth for documentation links (required for SEO)",
              priority: "high",
            },
            {
              action: "Setup GitHub Pages Deployment",
              toolRequired: "deploy_pages",
              description: "Create automated deployment workflow",
              priority: "medium",
            },
          ],
        };
    
        return formatMCPResponse(response);
      } catch (error) {
        const errorResponse: MCPToolResponse = {
          success: false,
          error: {
            code: "STRUCTURE_SETUP_FAILED",
            message: `Failed to setup structure: ${error}`,
            resolution: "Ensure the documentation path is writable and accessible",
          },
          metadata: {
            toolVersion: "1.0.0",
            executionTime: Date.now() - startTime,
            timestamp: new Date().toISOString(),
          },
        };
        return formatMCPResponse(errorResponse);
      }
    }
  • Constant defining the four Diataxis categories with descriptions and example filenames used to structure the documentation directories and files.
    const DIATAXIS_STRUCTURE = {
      tutorials: {
        description: "Learning-oriented guides for newcomers",
        example: "getting-started.md",
      },
      "how-to": {
        description: "Task-oriented guides for specific goals",
        example: "deploy-to-production.md",
      },
      reference: {
        description: "Information-oriented technical descriptions",
        example: "api-documentation.md",
      },
      explanation: {
        description: "Understanding-oriented conceptual discussions",
        example: "architecture-overview.md",
      },
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Create' implying a write/mutation operation, but doesn't specify whether this overwrites existing files, requires specific permissions, or has side effects like generating example content. The mention of 'Diataxis-compliant' hints at a standard structure, but lacks details on what that entails or the tool's output format.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and low schema description coverage (33%), the description is incomplete for a tool that creates documentation structures. It doesn't address behavioral traits like mutation effects, error handling, or output format, and lacks parameter guidance, leaving significant gaps for an AI agent to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 33% (only 'path' has a description), so the description must compensate but adds no parameter details. It doesn't explain what 'ssg' means (static site generator from the enum), what 'includeExamples' does, or how parameters interact. With low coverage and no compensation, this meets the baseline for minimal adequacy but leaves key semantics unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and the resource ('Diataxis-compliant documentation structure'), making the purpose specific and understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'populate_diataxis_content' or 'validate_diataxis_content', which appear related to Diataxis documentation workflows, so it misses full sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. Given sibling tools like 'populate_diataxis_content' (which might add content to an existing structure) and 'validate_diataxis_content' (which might check compliance), there's no indication of prerequisites, exclusions, or recommended contexts for setup_structure.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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