Skip to main content
Glama
PWalaGov

Enhanced Directory Context MCP Server

by PWalaGov

create_directory

Create new directories efficiently with specified paths, optionally enabling recursive parent directory creation for structured file management within the Enhanced Directory Context MCP Server.

Instructions

Create a new directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesDirectory path relative to working directory
recursiveNoCreate parent directories if needed

Implementation Reference

  • The handler function that implements the create_directory tool. It destructures path and recursive from args, resolves the full path relative to the working directory, creates the directory using fs.mkdir (supporting recursive creation of parents), and returns a success message or throws an MCP error on failure.
    async handleCreateDirectory(args) { const { path: dirPath, recursive = true } = args; const fullPath = path.resolve(this.workingDirectory, dirPath); try { await fs.mkdir(fullPath, { recursive }); return { content: [ { type: 'text', text: `Directory created: ${dirPath}`, }, ], }; } catch (error) { throw new McpError(ErrorCode.InternalError, `Failed to create directory: ${error.message}`); } }
  • Input schema for the create_directory tool, defining 'path' as required string and 'recursive' as optional boolean (default true).
    inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Directory path relative to working directory', }, recursive: { type: 'boolean', description: 'Create parent directories if needed', default: true, }, }, required: ['path'], },
  • server.js:319-336 (registration)
    Tool registration entry in the ListToolsRequestSchema handler, providing name, description, and inputSchema for create_directory.
    name: 'create_directory', description: 'Create a new directory', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Directory path relative to working directory', }, recursive: { type: 'boolean', description: 'Create parent directories if needed', default: true, }, }, required: ['path'], }, },
  • server.js:488-489 (registration)
    Registration/dispatch in the CallToolRequestSchema switch statement, routing calls to 'create_directory' to the handleCreateDirectory handler.
    case 'create_directory': return await this.handleCreateDirectory(args);

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/PWalaGov/File-Control-MCP'

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