Skip to main content
Glama

fast_find_large_files

Identify large files in directories by specifying minimum size thresholds to manage disk space and organize storage efficiently.

Instructions

Finds large files

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesDirectory to search in
min_sizeNoMinimum size (e.g., 100MB, 1GB)100MB
max_resultsNoMaximum number of results

Implementation Reference

  • Implements the core logic for finding large files recursively in the specified directory, filtering by minimum size, excluding certain paths, sorting by size descending, and limiting results.
    async function handleFindLargeFiles(args: any) {
      const { path: searchPath, min_size = '100MB', max_results = 50 } = args;
      
      const safePath_resolved = safePath(searchPath);
      const maxResults = Math.min(max_results, 100);
      
      // 크기 파싱 (예: 100MB -> bytes)
      const parseSize = (sizeStr: string): number => {
        const match = sizeStr.match(/^(\d+(\.\d+)?)\s*(B|KB|MB|GB|TB)?$/i);
        if (!match) return 100 * 1024 * 1024; // 기본값 100MB
        
        const value = parseFloat(match[1]);
        const unit = (match[3] || 'B').toUpperCase();
        
        const units: {[key: string]: number} = {
          'B': 1,
          'KB': 1024,
          'MB': 1024 * 1024,
          'GB': 1024 * 1024 * 1024,
          'TB': 1024 * 1024 * 1024 * 1024
        };
        
        return value * (units[unit] || 1);
      };
      
      const minSizeBytes = parseSize(min_size);
      const results: any[] = [];
      
      async function findLargeFilesRecursive(dirPath: string) {
        if (results.length >= maxResults) return;
        
        try {
          const entries = await fs.readdir(dirPath, { withFileTypes: true });
          
          for (const entry of entries) {
            if (results.length >= maxResults) break;
            
            const fullPath = path.join(dirPath, entry.name);
            
            if (shouldExcludePath(fullPath)) continue;
            
            if (entry.isFile()) {
              try {
                const stats = await fs.stat(fullPath);
                if (stats.size >= minSizeBytes) {
                  results.push({
                    path: fullPath,
                    name: entry.name,
                    size: stats.size,
                    size_readable: formatSize(stats.size),
                    modified: stats.mtime.toISOString(),
                    extension: path.extname(fullPath)
                  });
                }
              } catch {
                // 파일 접근 실패 무시
              }
            } else if (entry.isDirectory()) {
              await findLargeFilesRecursive(fullPath);
            }
          }
        } catch {
          // 권한 없는 디렉토리 무시
        }
      }
      
      await findLargeFilesRecursive(safePath_resolved);
      
      // 크기별로 정렬 (큰 것부터)
      results.sort((a, b) => b.size - a.size);
      
      return {
        results: results,
        total_found: results.length,
        search_path: safePath_resolved,
        min_size: min_size,
        min_size_bytes: minSizeBytes,
        max_results_reached: results.length >= maxResults,
        timestamp: new Date().toISOString()
      };
    }
  • api/server.ts:347-349 (registration)
    Dispatches tool calls to the handleFindLargeFiles handler in the main switch statement.
    case 'fast_find_large_files':
      result = await handleFindLargeFiles(args);
      break;
  • api/server.ts:217-229 (registration)
    Registers the tool in the MCP_TOOLS array with name, description, and input schema.
    {
      name: 'fast_find_large_files',
      description: '큰 파일들을 찾습니다',
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: '검색할 디렉토리' },
          min_size: { type: 'string', description: '최소 크기 (예: 100MB, 1GB)', default: '100MB' },
          max_results: { type: 'number', description: '최대 결과 수', default: 50 }
        },
        required: ['path']
      }
    }
  • Defines the input schema for the fast_find_large_files tool, specifying parameters like path, min_size, and max_results.
    inputSchema: {
      type: 'object',
      properties: {
        path: { type: 'string', description: '검색할 디렉토리' },
        min_size: { type: 'string', description: '최소 크기 (예: 100MB, 1GB)', default: '100MB' },
        max_results: { type: 'number', description: '최대 결과 수', default: 50 }
      },
      required: ['path']
  • Utility function to format file sizes in human-readable format, used in the handler output.
    function formatSize(bytes: number): string {
      const units = ['B', 'KB', 'MB', 'GB', 'TB'];
      let size = bytes;
      let unitIndex = 0;
      
      while (size >= 1024 && unitIndex < units.length - 1) {
        size /= 1024;
        unitIndex++;
      }
      
      return `${size.toFixed(2)} ${units[unitIndex]}`;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Finds large files' implies a read-only, non-destructive operation, but it doesn't specify performance characteristics (e.g., speed implied by 'fast' in the name), potential rate limits, permissions required, or output format. It adds minimal context beyond the basic action, leaving gaps in understanding how the tool behaves.

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 'Finds large files'—a single, front-loaded sentence that directly states the purpose without waste. It's appropriately sized for a simple tool, though this conciseness contributes to gaps in other dimensions. Every word earns its place by conveying the core action.

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 the tool has no annotations, no output schema, and 3 parameters, the description is incomplete. It doesn't explain what 'finds' entails (e.g., returns file paths, sizes, metadata), how results are ordered, or error handling. For a tool with moderate complexity and no structured behavioral hints, 'Finds large files' is too minimal to provide adequate context for an agent to use it effectively.

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 parameters are well-documented in the schema itself. The description adds no additional meaning about parameters beyond implying size-based filtering through 'large files'. It doesn't explain parameter interactions or provide examples beyond what the schema offers. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't detract.

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

Purpose3/5

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

The description 'Finds large files' states a clear verb ('finds') and resource ('large files'), providing basic purpose. However, it lacks specificity about what constitutes 'large' (though the schema clarifies via min_size parameter) and doesn't distinguish from sibling tools like fast_search_files or fast_get_directory_tree, which might have overlapping functionality. It's not tautological but remains somewhat vague.

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 sibling tools like fast_search_files (which might search by content) or fast_get_directory_tree (which lists files without size filtering), nor does it specify prerequisites or exclusions. Usage is implied by the name and schema, but no explicit context is given.

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

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