Skip to main content
Glama

create_documentation_section

Create a new documentation section with an index file to organize content in markdown documentation systems.

Instructions

Create a new navigation section with an index.md file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
titleYes
orderNo

Implementation Reference

  • The core handler implementation for the create_documentation_section tool. This method in the DocumentHandler class creates a new directory at the specified path and generates an index.md file with appropriate frontmatter (title, description, date, status, optional order) and basic content.
    async createSection(
      title: string,
      sectionPath: string,
      order?: number
    ): Promise<ToolResponse> {
      try {
        // Create the directory for the section
        const validPath = await this.validatePath(sectionPath);
        await fs.mkdir(validPath, { recursive: true });
    
        // Create an index.md file for the section
        const indexPath = path.join(validPath, "index.md");
        const validIndexPath = await this.validatePath(indexPath);
    
        // Create content with frontmatter
        let content = "---\n";
        content += `title: ${title}\n`;
        content += `description: ${title} section\n`;
        content += `date: ${new Date().toISOString()}\n`;
        content += `status: published\n`;
        if (order !== undefined) {
          content += `order: ${order}\n`;
        }
        content += "---\n\n";
        content += `# ${title}\n\n`;
        content += `Welcome to the ${title} section.\n`;
    
        // Write the index file
        await fs.writeFile(validIndexPath, content, "utf-8");
    
        return {
          content: [
            {
              type: "text",
              text: `Successfully created section: ${title} at ${sectionPath}`,
            },
          ],
          metadata: {
            title,
            path: sectionPath,
            indexPath: path.join(sectionPath, "index.md"),
            order,
          },
        };
      } catch (error) {
        const errorMessage =
          error instanceof Error ? error.message : String(error);
        return {
          content: [
            { type: "text", text: `Error creating section: ${errorMessage}` },
          ],
          isError: true,
        };
      }
    }
  • Zod schema defining the input parameters for the create_documentation_section tool: title (required string), path (required string), order (optional number). Extends base ToolInputSchema.
    export const CreateSectionSchema = ToolInputSchema.extend({
      title: z.string(),
      path: z.string(),
      order: z.number().optional(),
    });
  • src/index.ts:278-282 (registration)
    Tool registration in the ListToolsRequestHandler, defining the tool name, description, and input schema for create_documentation_section.
    {
      name: "create_documentation_section",
      description: "Create a new navigation section with an index.md file.",
      inputSchema: zodToJsonSchema(CreateSectionSchema) as any,
    },
  • src/index.ts:455-467 (registration)
    Tool dispatch in the CallToolRequestHandler switch statement. Note: uses case 'create_section' (possible mismatch with tool name 'create_documentation_section'), parses input with CreateSectionSchema, and calls documentHandler.createSection.
    case "create_section": {
      const parsed = CreateSectionSchema.safeParse(args);
      if (!parsed.success) {
        throw new Error(
          `Invalid arguments for create_section: ${parsed.error}`
        );
      }
      return await documentHandler.createSection(
        parsed.data.title,
        parsed.data.path,
        parsed.data.order
      );
    }
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 the tool creates a section and an index.md file, implying a write operation, but lacks details on permissions needed, whether it overwrites existing files, error handling, or the response format. This leaves significant gaps for safe and effective use.

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 function without unnecessary words. It's front-loaded and wastes no space, 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 the complexity of a creation tool with three parameters, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like side effects, error cases, or return values, nor does it clarify parameter usage, making it inadequate for reliable agent operation.

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

Parameters2/5

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

The description mentions 'navigation section' but doesn't explain how parameters like 'path', 'title', and 'order' relate to this. With 0% schema description coverage and three parameters (two required), the description fails to add meaningful context beyond the schema, leaving parameters largely undocumented.

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 resource ('new navigation section with an index.md file'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'create_folder' or 'write_document', which might create similar content, leaving some ambiguity about when to choose this specific tool.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites, such as whether the path must exist or if it's for documentation-specific contexts, nor does it refer to sibling tools like 'create_folder' for comparison, leaving the agent to guess based on tool names alone.

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/alekspetrov/mcp-docs-service'

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