Skip to main content
Glama

create_directory

Creates a new directory and all required parent directories for file organization.

Instructions

Create a directory (and all parent directories).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesDirectory path to create
workspace_rootNoWorkspace root directory (optional)

Implementation Reference

  • Handler for the create_directory tool. Resolves the workspace path, then creates the directory (and all parent directories) using mkdir with recursive: true.
    case "create_directory": {
      const dirPath = resolveWorkspacePath(a.path as string, a.workspace_root as string | undefined);
      await mkdir(dirPath, { recursive: true });
      return { content: [{ type: "text", text: `Created: ${dirPath}` }] };
    }
  • Schema definition for create_directory tool: requires a 'path' string, optional 'workspace_root' string, and describes the tool as creating a directory with all parent directories.
    {
      name: "create_directory",
      description: "Create a directory (and all parent directories).",
      inputSchema: {
        type: "object",
        properties: {
          path: { type: "string", description: "Directory path to create" },
          workspace_root: { type: "string", description: "Workspace root directory (optional)" },
        },
        required: ["path"],
      },
    },
  • src/index.ts:221-232 (registration)
    Tool registration in the TOOLS array that is exposed via ListToolsRequestSchema. The tool definition is added to the array of available tools.
    {
      name: "create_directory",
      description: "Create a directory (and all parent directories).",
      inputSchema: {
        type: "object",
        properties: {
          path: { type: "string", description: "Directory path to create" },
          workspace_root: { type: "string", description: "Workspace root directory (optional)" },
        },
        required: ["path"],
      },
    },
  • Helper used by create_directory handler to resolve the path argument relative to the workspace root.
    function resolveWorkspacePath(filePath: string, workspaceRoot?: string): string {
      if (filePath.startsWith("/") || /^[A-Za-z]:/.test(filePath)) return filePath;
      const base = workspaceRoot ?? process.cwd();
      return resolve(join(base, filePath));
    }
Behavior3/5

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

The description discloses the mkdir -p behavior (creating parent directories), which is helpful, but omits other behaviors like error handling when directory already exists or permission requirements. With no annotations, more detail would be beneficial.

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?

Single sentence with no extraneous information. The key behavior is front-loaded and clearly stated.

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

Completeness3/5

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

For a simple tool, the description covers the main purpose but lacks details about success/failure outcomes (e.g., behavior if directory exists). Without an output schema, the agent may lack complete context.

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?

The input schema describes both parameters with 100% coverage, and the description adds no additional meaning beyond what the schema already provides.

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

Purpose5/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 (directory), and explicitly mentions creating parent directories, which distinguishes it from sibling tools like delete_path or list_directory.

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 on when to use this tool vs alternatives, nor any prerequisites or conditions. It simply describes what the tool does without context for selection.

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/KloutDevs/vscode-mcp'

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