remove_directory
Delete specified directories in Obsidian vaults stored on iCloud Drive using the Model Context Protocol to manage file structures efficiently.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Implementation Reference
- src/file-system.ts:325-334 (handler)The main handler function for the remove_directory tool. Parses input arguments using RemoveDirectoryArgsSchema, removes the specified directory using the rimraf library, and returns a textual response with the result.
export async function removeDirectory(args?: Record<string, unknown>) { const parsed = RemoveDirectoryArgsSchema.safeParse(args) if (!parsed.success) { throw new Error(`Invalid arguments for remove_directory: ${parsed.error}`) } const result = await rimraf(parsed.data.path) return { content: [{ type: 'text', text: result }] } } - src/schemas.ts:42-44 (schema)Zod schema defining the input for remove_directory: requires a 'path' string parameter.
export const RemoveDirectoryArgsSchema = z.object({ path: z.string() }) - src/index.ts:141-144 (registration)Registration of the remove_directory tool in the ListToolsRequestHandler response. Specifies the tool name, description from prompt (which is empty), and converts the Zod schema to JSON schema for input validation.
name: 'remove_directory', description: removeDirectoryPrompt(), inputSchema: zodToJsonSchema(RemoveDirectoryArgsSchema) as ToolInput }, - src/index.ts:203-205 (registration)Dispatch logic in the CallToolRequestHandler switch statement that routes calls to the remove_directory tool by invoking the removeDirectory function from file-system.ts.
case 'remove_directory': { return removeDirectory(args) } - src/file-system.ts:13-25 (helper)Import of RemoveDirectoryArgsSchema (among others) from schemas.ts into file-system.ts, enabling validation within the handler.
CreateDirectoryArgsSchema, EditFileArgsSchema, FullTextSearchArgsSchema, ListDirectoryArgsSchema, MoveFileArgsSchema, ReadFileArgsSchema, ReadMultipleFilesArgsSchema, RemoveDirectoryArgsSchema, RemoveFileArgsSchema, RemoveMultipleDirectoryArgsSchema, RemoveMultipleFilesArgsSchema, WriteFileArgsSchema } from './schemas.js'