Skip to main content
Glama
StrawHatAI

Claude Desktop Commander MCP

by StrawHatAI

get_file_info

Retrieve file metadata including size, timestamps, permissions, and type for analysis within Claude Desktop Commander's 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 validates the file path security and retrieves file/directory stats 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),
        };
    }
  • Zod schema for input validation of the get_file_info tool, requiring a single 'path' string parameter.
    export const GetFileInfoArgsSchema = z.object({
      path: z.string(),
    });
  • src/server.ts:180-187 (registration)
    Tool registration in the ListTools response, defining 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),
    },
  • src/server.ts:315-326 (registration)
    Dispatcher case in CallToolRequestHandler that parses input, calls getFileInfo handler, and formats the response.
    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 directory restriction ('Only works within allowed directories'), which is useful behavioral context. However, it lacks details on error handling, permissions needed, rate limits, or response format, leaving gaps for a read operation with no output schema.

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 clause, followed by specific attributes and a constraint. Every sentence earns its place with no redundancy, making it efficient and well-structured for quick understanding.

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 and no output schema, the description is moderately complete. It covers the purpose, attributes, and a key constraint, but lacks details on return values, error cases, or behavioral nuances. For a tool with 1 parameter and no structured output, it meets minimum viability but has clear gaps.

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 input schema has 1 parameter with 0% description coverage, 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, examples, or constraints like absolute vs. relative paths.

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 permissions. It distinguishes from siblings like list_directory (which lists contents) or read_file (which reads file content), making the purpose unambiguous.

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 'Only works within allowed directories,' indicating a constraint. However, it does not explicitly state when to use this tool versus alternatives like list_directory (for listing) or search_files (for finding), nor does it mention prerequisites or exclusions beyond the directory restriction.

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/StrawHatAI/claude-dev-tools'

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