Skip to main content
Glama

fast_get_file_info

Retrieve detailed metadata for any file or directory, including size, type, and timestamps, to quickly assess file properties without opening them.

Instructions

Gets detailed information about a file or directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to get info for

Implementation Reference

  • The actual handler function 'handleGetFileInfo' that executes the 'fast_get_file_info' tool logic. It resolves the path via safePath, reads file stats using fs.stat, and returns detailed file/directory info including path, name, type, size, timestamps, permissions, and for files: extension, MIME type, and chunking guide for large files; for directories: item count and pagination guide.
    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 for the 'fast_get_file_info' tool. Defines that it accepts a single required 'path' parameter of type string.
      name: 'fast_get_file_info',
      description: '파일/디렉토리 상세 정보를 조회합니다',
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: '조회할 경로' }
        },
        required: ['path']
      }
    },
  • api/server.ts:332-334 (registration)
    Registration of 'fast_get_file_info' in the tools/call switch statement, routing to handleGetFileInfo handler.
    case 'fast_get_file_info':
      result = await handleGetFileInfo(args);
      break;
  • The 'safePath' helper function used to validate and resolve the input path, checking it against allowed directories.
    function safePath(inputPath: string): string {
      if (!isPathAllowed(inputPath)) {
        throw new Error(`Access denied to path: ${inputPath}`);
      }
      return path.resolve(inputPath);
    }
  • The 'getMimeType' helper function used to determine MIME type based on file extension.
    function getMimeType(filePath: string): string {
      const ext = path.extname(filePath).toLowerCase();
      const mimeTypes: {[key: string]: string} = {
        '.txt': 'text/plain',
        '.html': 'text/html',
        '.css': 'text/css',
        '.js': 'application/javascript',
        '.json': 'application/json',
        '.png': 'image/png',
        '.jpg': 'image/jpeg',
        '.jpeg': 'image/jpeg',
        '.gif': 'image/gif',
        '.pdf': 'application/pdf',
        '.zip': 'application/zip',
        '.md': 'text/markdown'
      };
      
      return mimeTypes[ext] || 'application/octet-stream';
    }
Behavior2/5

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

No annotations exist, so the description must disclose behavior. It only says 'detailed information' without specifying what fields are returned (size, permissions, timestamps, etc.). This is too vague for an agent to predict the output.

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 a single sentence with no superfluous words. It is front-loaded and efficient.

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?

There is no output schema, so the description should explain the return value. It fails to do so, leaving the agent uncertain about what 'detailed information' includes. For a simple tool, this is a significant gap.

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?

The schema describes the single 'path' parameter adequately. With 100% schema coverage, the description adds no extra meaning beyond what the schema provides. Baseline score of 3 is appropriate.

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

Purpose5/5

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

The description clearly states the tool retrieves detailed info about a file or directory. It uses the verb 'gets' and specific resource, distinguishing it from siblings like fast_list_directory or fast_delete_file.

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?

No guidance is provided on when to use this tool versus alternatives like fast_list_directory or fast_get_directory_tree. The agent receives no context for appropriate use cases or exclusions.

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