Skip to main content
Glama
StrawHatAI

Claude Desktop Commander MCP

by StrawHatAI

create_directory

Generate or verify the existence of directories with a single command. Supports creating nested directories in one operation, ensuring file system organization within designated paths.

Instructions

Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. Only works within allowed directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • The core handler function that performs path validation and creates the directory using Node.js fs.mkdir with recursive option to handle nested paths.
    export async function createDirectory(dirPath: string): Promise<void> { const validPath = await validatePath(dirPath); await fs.mkdir(validPath, { recursive: true }); }
  • Zod schema defining the input shape for the create_directory tool: requires a 'path' string.
    export const CreateDirectoryArgsSchema = z.object({ path: z.string(), });
  • src/server.ts:150-155 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema.
    name: "create_directory", description: "Create a new directory or ensure a directory exists. Can create multiple " + "nested directories in one operation. Only works within allowed directories.", inputSchema: zodToJsonSchema(CreateDirectoryArgsSchema), },
  • src/server.ts:287-292 (registration)
    Dispatch handler in CallToolRequestSchema that parses input with schema and invokes the createDirectory function.
    case "create_directory": { const parsed = CreateDirectoryArgsSchema.parse(args); await createDirectory(parsed.path); return { content: [{ type: "text", text: `Successfully created directory ${parsed.path}` }], };

Other Tools

Related 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/StrawHatAI/claude-dev-tools'

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