Skip to main content
Glama
MrGNSS

Desktop Commander MCP

get_file_info

Retrieve detailed file metadata including size, timestamps, permissions, and type to analyze file properties and manage system resources within allowed directories.

Instructions

Retrieve detailed metadata about a file or directory including size, creation time, last modified time, permissions, and type. Only works within allowed directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • The core handler function that implements the get_file_info tool logic: validates the file path for security and retrieves comprehensive file metadata including size, timestamps, type, and permissions.
    export async function getFileInfo(filePath: string): Promise<Record<string, any>> {
        const validPath = await validatePath(filePath);
        const stats = await fs.stat(validPath);
        
        return {
            size: stats.size,
            created: stats.birthtime,
            modified: stats.mtime,
            accessed: stats.atime,
            isDirectory: stats.isDirectory(),
            isFile: stats.isFile(),
            permissions: stats.mode.toString(8).slice(-3),
        };
    }
  • src/server.ts:180-187 (registration)
    Tool registration in the MCP server's ListTools response, defining the name, description, and input schema for get_file_info.
    {
      name: "get_file_info",
      description:
        "Retrieve detailed metadata about a file or directory including size, " +
        "creation time, last modified time, permissions, and type. " +
        "Only works within allowed directories.",
      inputSchema: zodToJsonSchema(GetFileInfoArgsSchema),
    },
  • Zod input schema for the get_file_info tool, validating the required 'path' parameter.
    export const GetFileInfoArgsSchema = z.object({
      path: z.string(),
    });
  • Server-side dispatcher handler for get_file_info: parses input args, invokes the core getFileInfo function, and formats the response for MCP.
    case "get_file_info": {
      const parsed = GetFileInfoArgsSchema.parse(args);
      const info = await getFileInfo(parsed.path);
      return {
        content: [{ 
          type: "text", 
          text: Object.entries(info)
            .map(([key, value]) => `${key}: ${value}`)
            .join('\n') 
        }],
      };
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the constraint about allowed directories, which is useful behavioral context. However, it lacks details on permissions needed, rate limits, error handling, or what happens if the path is invalid, leaving gaps in behavioral transparency for a read operation.

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 front-loaded with the core purpose in the first sentence, followed by a critical constraint in the second. Both sentences earn their place by providing essential information without redundancy, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and low schema coverage, the description is moderately complete. It covers the purpose and a key constraint but lacks details on return values, error cases, or full parameter semantics. For a tool with one parameter and no structured support, it should do more to be fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It implies the 'path' parameter is used to specify the file or directory for metadata retrieval, adding meaning beyond the bare schema. However, it does not detail path format or examples, leaving some ambiguity.

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 specific action ('Retrieve detailed metadata') and resource ('about a file or directory'), listing concrete attributes like size, creation time, and type. It distinguishes from siblings like 'list_directory' (which lists contents) and 'read_file' (which reads file content) by focusing on metadata retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context with the constraint 'Only works within allowed directories', which implicitly guides usage by indicating where it can be applied. However, it does not explicitly state when to use alternatives like 'list_directory' for listing contents or 'read_file' for reading content, nor does it mention 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/MrGNSS/ClaudeDesktopCommander'

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