Skip to main content
Glama

fast_get_file_info

Retrieve detailed file or directory information including metadata and properties from a specified path using the fast-filesystem-mcp server.

Instructions

Gets detailed information about a file or directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to get info for

Implementation Reference

  • The handler function that executes the tool logic: resolves path safely, stats the file/dir, builds info object with size, timestamps, permissions, and adds file/dir specific fields like extension, mime_type, item_count, and Claude optimization guides.
    async function handleGetFileInfo(args: any) {
      const { path: targetPath } = args;
      
      const safePath_resolved = safePath(targetPath);
      const stats = await fs.stat(safePath_resolved);
      
      const info = {
        path: safePath_resolved,
        name: path.basename(safePath_resolved),
        type: stats.isDirectory() ? 'directory' : 'file',
        size: stats.size,
        size_readable: formatSize(stats.size),
        created: stats.birthtime.toISOString(),
        modified: stats.mtime.toISOString(),
        accessed: stats.atime.toISOString(),
        permissions: stats.mode,
        is_readable: true,
        is_writable: true
      };
      
      if (stats.isFile()) {
        (info as any).extension = path.extname(safePath_resolved);
        (info as any).mime_type = getMimeType(safePath_resolved);
        
        if (stats.size > CLAUDE_MAX_CHUNK_SIZE) {
          (info as any).claude_guide = {
            message: 'File is large, consider using chunked reading',
            recommended_chunk_size: CLAUDE_MAX_CHUNK_SIZE,
            total_chunks: Math.ceil(stats.size / CLAUDE_MAX_CHUNK_SIZE)
          };
        }
      } else if (stats.isDirectory()) {
        try {
          const entries = await fs.readdir(safePath_resolved);
          (info as any).item_count = entries.length;
          
          if (entries.length > CLAUDE_MAX_DIR_ITEMS) {
            (info as any).claude_guide = {
              message: 'Directory has many items, consider using pagination',
              recommended_page_size: CLAUDE_MAX_DIR_ITEMS,
              total_pages: Math.ceil(entries.length / CLAUDE_MAX_DIR_ITEMS)
            };
          }
        } catch {
          (info as any).item_count = 'Unable to count';
        }
      }
      
      return info;
    }
  • Input schema definition requiring a 'path' parameter of type string.
    inputSchema: {
      type: 'object',
      properties: {
        path: { type: 'string', description: '조회할 경로' }
      },
      required: ['path']
    }
  • api/server.ts:332-334 (registration)
    Switch case registration that calls the handleGetFileInfo function when the tool is invoked.
    case 'fast_get_file_info':
      result = await handleGetFileInfo(args);
      break;
  • api/server.ts:155-165 (registration)
    Tool definition in MCP_TOOLS array used for tools/list endpoint, including name, description, and schema.
    {
      name: 'fast_get_file_info',
      description: '파일/디렉토리 상세 정보를 조회합니다',
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: '조회할 경로' }
        },
        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/efforthye/fast-filesystem-mcp'

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