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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states the action ('Create a new directory') but doesn't disclose permissions needed, error conditions (e.g., if path exists), side effects, or response format. For a mutation tool without annotations, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single sentence ('Create a new directory'), front-loaded and zero waste. It efficiently conveys the core purpose without unnecessary elaboration, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on permissions, error handling, return values, and how it integrates with sibling tools like 'create_file'. For a tool that modifies the filesystem, more context is needed for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters ('path' and 'recursive'). The description adds no additional parameter semantics beyond what's in the schema, such as path format examples or recursive behavior implications, meeting the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Create') and resource ('directory'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'create_file' or 'batch_file_operations', which would require mentioning it specifically creates directories rather than files or performing batch operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose 'create_directory' over 'create_file' for file creation, or how it relates to 'set_working_directory' for path management, leaving the agent without context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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