create_directory
Set up or verify directory structures for projects by creating new or nested directories in one operation. Ensures required paths exist silently within allowed directories on the Obsidian iCloud MCP server.
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. Perfect for setting up directory structures for projects or ensuring required paths exist. Only works within allowed directories.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Implementation Reference
- src/file-system.ts:293-307 (handler)Implements the create_directory tool by parsing args with schema, creating directory with fs.mkdir (recursive), and returning success message.export async function createDirectory(args?: Record<string, unknown>) { const parsed = CreateDirectoryArgsSchema.safeParse(args) if (!parsed.success) { throw new Error(`Invalid arguments for create_directory: ${parsed.error}`) } await fs.mkdir(parsed.data.path, { recursive: true }) return { content: [ { type: 'text', text: `Successfully created directory ${parsed.data.path}` } ] } }
- src/schemas.ts:38-40 (schema)Zod schema defining input for create_directory: object with 'path' string.export const CreateDirectoryArgsSchema = z.object({ path: z.string() })
- src/index.ts:130-134 (registration)Registers the 'create_directory' tool in ListToolsRequestHandler with name, prompt-based description, and schema.{ name: 'create_directory', description: createDirectoryPrompt(), inputSchema: zodToJsonSchema(CreateDirectoryArgsSchema) as ToolInput },
- src/index.ts:195-197 (registration)Dispatches calls to 'create_directory' tool by invoking the createDirectory handler function in CallToolRequestHandler.case 'create_directory': { return createDirectory(args) }