Skip to main content
Glama
ai-yliu

Filesystem MCP Server

by ai-yliu

create_directory

Create a new directory or verify its existence at a specified path to organize files and manage storage structure.

Instructions

Create new directory or ensure it exists

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the directory to create

Implementation Reference

  • The handler logic for the 'create_directory' tool. It validates the provided path, ensures the directory exists using fs.ensureDir, and returns a success message.
    case 'create_directory': {
      const { path: dirPath } = request.params.arguments as { path: string };
      validatePath(dirPath);
      
      await fs.ensureDir(dirPath);
      
      return {
        content: [
          {
            type: 'text',
            text: `Directory created successfully: ${dirPath}`,
          },
        ],
      };
    }
  • src/index.ts:144-157 (registration)
    Registration of the 'create_directory' tool in the ListTools response, including its name, description, and input schema definition.
    {
      name: 'create_directory',
      description: 'Create new directory or ensure it exists',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Path to the directory to create',
          },
        },
        required: ['path'],
      },
    },
  • Input schema for the 'create_directory' tool, defining the required 'path' parameter.
    inputSchema: {
      type: 'object',
      properties: {
        path: {
          type: 'string',
          description: 'Path to 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/ai-yliu/filesystem-mcp-server'

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