Skip to main content
Glama

fast_find_large_files

Identify and locate large files within a specified directory based on minimum size and limit results. Optimized for efficient file system analysis on overflow-proof, high-reliability MCP servers.

Instructions

큰 파일들을 찾습니다

Input Schema

NameRequiredDescriptionDefault
max_resultsNo최대 결과 수
min_sizeNo최소 크기 (예: 100MB, 1GB)100MB
pathYes검색할 디렉토리

Input Schema (JSON Schema)

{ "properties": { "max_results": { "default": 50, "description": "최대 결과 수", "type": "number" }, "min_size": { "default": "100MB", "description": "최소 크기 (예: 100MB, 1GB)", "type": "string" }, "path": { "description": "검색할 디렉토리", "type": "string" } }, "required": [ "path" ], "type": "object" }

Implementation Reference

  • Implements the core logic for finding large files recursively from the specified directory. Parses min_size (e.g., '100MB'), traverses directories excluding patterns, collects files above threshold, sorts by size descending, limits 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() }; }
  • Input schema defining parameters for the tool: path (required), min_size (default '100MB'), max_results (default 50).
    { 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'] } }
  • api/server.ts:347-349 (registration)
    Registration in the main tool dispatch switch statement, mapping tool name to handler function.
    case 'fast_find_large_files': result = await handleFindLargeFiles(args); break;

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