Skip to main content
Glama

create_directory

Create nested directories in your MCP Notes system to organize and structure your personal knowledge base efficiently. Specify the relative path for easy setup.

Instructions

Create a new directory in your notes. Can create nested directories in one operation. Path should be relative to your notes directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesDirectory path to create, relative to notes directory

Implementation Reference

  • The handler function that validates the path, ensures it's within the notes directory, and creates the directory using fs.mkdir with recursive: true. Returns success or error message.
    export async function handleCreateDirectory(notesPath: string, args: CreateDirectoryArgs): Promise<ToolCallResult> { try { // Validate path parameter if (!args.path) { throw new Error("'path' parameter is required"); } const dirPath = path.join(notesPath, args.path); // Ensure the path is within allowed directory if (!dirPath.startsWith(notesPath)) { throw new Error("Access denied - path outside notes directory"); } try { await fs.mkdir(dirPath, { recursive: true }); return { content: [{ type: "text", text: `Successfully created directory: ${args.path}` }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); throw new Error(`Error creating directory: ${errorMessage}`); } } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error creating directory: ${errorMessage}` }], isError: true }; } }
  • Tool definition object for 'create_directory' including the input schema requiring a 'path' string.
    { name: "create_directory", description: "Create a new directory in your notes. " + "Can create nested directories in one operation. " + "Path should be relative to your notes directory.", inputSchema: { type: "object", properties: { path: { type: "string", description: "Directory path to create, relative to notes directory" } }, required: ["path"] }, }
  • Switch case in handleToolCall that registers and dispatches the 'create_directory' tool to its handler.
    case "create_directory": return await handleCreateDirectory(notesPath, args);
  • TypeScript interface defining the input arguments for the create_directory handler.
    interface CreateDirectoryArgs { path: string; }
  • Import of the handleCreateDirectory function from filesystem.js for use in tool dispatching.
    handleCreateDirectory,

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/mikeysrecipes/mcp-notes'

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