create_directory
Create new directories or ensure existing directories are available. Handles nested directory structures in a single operation and succeeds silently if directories already exist.
Instructions
Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. If the directory already exists, this operation will succeed silently.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The path of the directory to create |
Implementation Reference
- src/index.ts:342-353 (handler)The handler logic for the 'create_directory' tool. It extracts the directory path from arguments, creates the directory using fs.mkdir with recursive: true to handle nested directories, and returns a success message in the expected MCP content format.case "create_directory": { const dirPath = args.path as string; await fs.mkdir(dirPath, { recursive: true }); return { content: [ { type: "text", text: `Successfully created directory ${dirPath}`, }, ], }; }
- src/index.ts:84-97 (registration)Registers the 'create_directory' tool in the TOOLS array, which is returned by the ListTools handler. Includes 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. If the directory already exists, this operation will succeed silently.", inputSchema: { type: "object", properties: { path: { type: "string", description: "The path of the directory to create", }, }, required: ["path"], }, },
- src/index.ts:87-96 (schema)Input schema definition for the 'create_directory' tool, specifying an object with a required 'path' string property.inputSchema: { type: "object", properties: { path: { type: "string", description: "The path of the directory to create", }, }, required: ["path"], },