Skip to main content
Glama

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
NameRequiredDescriptionDefault
pathYesThe path of the directory to create

Implementation Reference

  • 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"], }, },
  • 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"], },

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/koopatroopa787/first_mcp'

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