fast_get_file_info
Retrieve detailed information about files or directories by specifying their path, ensuring accurate data for efficient filesystem management.
Instructions
파일/디렉토리 상세 정보를 조회합니다
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | 조회할 경로 |
Input Schema (JSON Schema)
{
"properties": {
"path": {
"description": "조회할 경로",
"type": "string"
}
},
"required": [
"path"
],
"type": "object"
}
Implementation Reference
- api/server.ts:611-660 (handler)The handler function for 'fast_get_file_info' tool. It resolves the path safely, gets file stats, adds formatted info, extension, MIME type for files, item count for directories, and Claude-specific guidance for large files/directories.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; }
- api/server.ts:155-164 (schema)The input schema definition for the 'fast_get_file_info' tool, specifying the required 'path' parameter.{ name: 'fast_get_file_info', description: '파일/디렉토리 상세 정보를 조회합니다', inputSchema: { type: 'object', properties: { path: { type: 'string', description: '조회할 경로' } }, required: ['path'] }
- api/server.ts:332-333 (registration)The switch case registration that dispatches to the handleGetFileInfo handler function.case 'fast_get_file_info': result = await handleGetFileInfo(args);
- api/server.ts:310-310 (registration)The tools/list response includes MCP_TOOLS array which registers the tool schema.tools: MCP_TOOLS
- api/server.ts:45-55 (helper)Helper function used in handler to format file size in human-readable units.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]}`;