Skip to main content
Glama
PWalaGov

Enhanced Directory Context MCP Server

by PWalaGov

create_directory

Create new directories in your file system, including parent directories when needed, to organize project files and structure.

Instructions

Create a new directory

Input Schema

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

Implementation Reference

  • The main handler function that implements the create_directory tool. It resolves the directory path relative to the working directory, creates the directory using fs.mkdir (with optional recursive creation), and returns a success message or throws an error.
    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 definition for the create_directory tool, specifying the path parameter (required) and optional recursive flag.
    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:318-336 (registration)
    Tool registration in the ListToolsRequestSchema response, defining name, description, and input schema.
    { 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)
    Switch case in CallToolRequestSchema handler that routes create_directory calls to the handler method.
    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