Skip to main content
Glama
StrawHatAI

Claude Desktop Commander MCP

by StrawHatAI

create_directory

Create new directories or ensure existing ones are available, including nested structures, within permitted file system locations.

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 main handler function that validates the directory path 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 }); }
  • The dispatch handler in the main tool request handler that parses input arguments using the schema and calls the specific createDirectory function.
    case "create_directory": { const parsed = CreateDirectoryArgsSchema.parse(args); await createDirectory(parsed.path); return { content: [{ type: "text", text: `Successfully created directory ${parsed.path}` }], };
  • Zod schema defining the input arguments for the create_directory tool: a required 'path' string.
    export const CreateDirectoryArgsSchema = z.object({ path: z.string(), });
  • src/server.ts:149-155 (registration)
    Registers the create_directory tool in the MCP server tools list, providing name, description, and JSON schema derived from Zod 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), },

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