Skip to main content
Glama

create_folder

Create a new folder in the documentation directory and optionally generate a README.md file with basic frontmatter to organize and structure documentation content.

Instructions

Create a new folder in the docs directory. Optionally creates a README.md file in the new folder with basic frontmatter.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
createReadmeNo

Implementation Reference

  • Core implementation of the create_folder tool logic in the DocumentHandler class. Validates path, creates directory with fs.mkdir (recursive), and optionally creates a README.md file with frontmatter.
      async createFolder(
        folderPath: string,
        createReadme = true
      ): Promise<ToolResponse> {
        try {
          const validPath = await this.validatePath(folderPath);
    
          // Create the directory
          await fs.mkdir(validPath, { recursive: true });
    
          // Create a README.md file if requested
          if (createReadme) {
            const readmePath = path.join(validPath, "README.md");
            const folderName = path.basename(validPath);
            const content = `---
    title: ${folderName}
    description: Documentation for ${folderName}
    date: ${new Date().toISOString()}
    status: draft
    ---
    
    # ${folderName}
    
    This is the documentation for ${folderName}.
    `;
            await fs.writeFile(readmePath, content, "utf-8");
          }
    
          return {
            content: [
              { type: "text", text: `Successfully created folder: ${folderPath}` },
            ],
            metadata: {
              path: folderPath,
              readme: createReadme ? path.join(folderPath, "README.md") : null,
            },
          };
        } catch (error) {
          const errorMessage =
            error instanceof Error ? error.message : String(error);
          return {
            content: [
              { type: "text", text: `Error creating folder: ${errorMessage}` },
            ],
            isError: true,
          };
        }
      }
  • Zod schema defining input validation for the create_folder tool: path (string, required), createReadme (boolean, default true). Extends ToolInputSchema.
    export const CreateFolderSchema = ToolInputSchema.extend({
      path: z.string(),
      createReadme: z.boolean().default(true),
    });
  • src/index.ts:252-257 (registration)
    MCP tool registration for 'create_documentation_folder' (references create_folder in error messages), including description and input schema conversion.
      name: "create_documentation_folder",
      description:
        "Create a new folder in the docs directory. Optionally creates a README.md file " +
        "in the new folder with basic frontmatter.",
      inputSchema: zodToJsonSchema(CreateFolderSchema) as any,
    },
  • src/index.ts:401-412 (registration)
    Dispatch handler in MCP server that parses arguments with CreateFolderSchema and delegates to documentHandler.createFolder method.
    case "create_documentation_folder": {
      const parsed = CreateFolderSchema.safeParse(args);
      if (!parsed.success) {
        throw new Error(
          `Invalid arguments for create_folder: ${parsed.error}`
        );
      }
      return await documentHandler.createFolder(
        parsed.data.path,
        parsed.data.createReadme
      );
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions the optional README creation with 'basic frontmatter,' which adds some behavioral context, but fails to disclose critical details like required permissions, whether the operation is idempotent, error handling, or what happens if the folder already exists. This is a significant gap for a mutation tool.

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 two sentences, front-loaded with the primary purpose and followed by an optional feature. Every sentence adds value without redundancy, making it efficient and well-structured for quick comprehension.

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 mutation tool with no annotations and no output schema, the description is incomplete. It lacks information on return values, error conditions, permissions, and how it interacts with sibling tools like 'list_documents' or 'validate_documentation_links'. The optional README detail is helpful but insufficient for full contextual understanding.

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 0%, so the description must compensate. It implies the 'path' parameter specifies the folder location and 'createReadme' controls README creation, adding meaning beyond the bare schema. However, it doesn't detail path format, constraints, or default behavior for 'createReadme' (though the schema shows default=true), leaving some ambiguity.

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 a new folder') and resource ('in the docs directory'), with an additional optional behavior ('creates a README.md file'). It distinguishes from siblings like 'create_documentation_section' by specifying folder creation rather than section creation, though it doesn't explicitly contrast them.

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 explicit guidance on when to use this tool versus alternatives like 'create_documentation_section' or 'write_document' is provided. The description implies usage for folder creation with optional README, but lacks context on prerequisites, exclusions, or comparisons to sibling tools.

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