Skip to main content
Glama

fast_create_directory

Create directories with optional recursive parent creation for organized file structures in the fast-filesystem-mcp environment.

Instructions

Creates a directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath of the directory to create
recursiveNoCreate parent directories if they do not exist

Implementation Reference

  • The main handler function that safely creates a directory using fs.mkdir after validating the path with safePath. Supports recursive creation.
    async function handleCreateDirectory(args: any) {
      const { path: dirPath, recursive = true } = args;
      
      const safePath_resolved = safePath(dirPath);
      await fs.mkdir(safePath_resolved, { recursive });
      
      return {
        message: 'Directory created successfully',
        path: safePath_resolved,
        recursive: recursive,
        timestamp: new Date().toISOString()
      };
    }
  • Tool schema definition including name, description, and inputSchema with parameters 'path' (required) and 'recursive' (optional boolean).
    {
      name: 'fast_create_directory',
      description: '디렉토리를 생성합니다',
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: '생성할 디렉토리 경로' },
          recursive: { type: 'boolean', description: '재귀적 생성', default: true }
        },
        required: ['path']
      }
    },
  • api/server.ts:335-337 (registration)
    Registration in the tool dispatcher switch statement, calling the handleCreateDirectory function.
    case 'fast_create_directory':
      result = await handleCreateDirectory(args);
      break;
  • Helper function used by the handler to validate and resolve the directory path safely.
    function safePath(inputPath: string): string {
      if (!isPathAllowed(inputPath)) {
        throw new Error(`Access denied to path: ${inputPath}`);
      }
      return path.resolve(inputPath);
    }

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/efforthye/fast-filesystem-mcp'

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