Skip to main content
Glama
rawr-ai

Filesystem MCP Server

get_file_info

Retrieve file or directory metadata, including size, type, permissions, creation, and modification times, to analyze file characteristics without accessing content. Works within permitted directories.

Instructions

Retrieve detailed metadata about a file or directory. Returns comprehensive information including size, creation time, last modified time, permissions, and type. This tool is perfect for understanding file characteristics without reading the actual content. Only works within allowed directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • The handler function for the 'get_file_info' tool. Parses input arguments using the schema, validates the file path, retrieves file statistics using getFileStats utility, and returns formatted metadata as text.
    export async function handleGetFileInfo(
      args: unknown,
      allowedDirectories: string[],
      symlinksMap: Map<string, string>,
      noFollowSymlinks: boolean
    ) {
      const parsed = parseArgs(GetFileInfoArgsSchema, args, 'get_file_info');
      const validPath = await validatePath(parsed.path, allowedDirectories, symlinksMap, noFollowSymlinks);
      const info = await getFileStats(validPath);
      return {
        content: [{ type: "text", text: Object.entries(info)
          .map(([key, value]) => `${key}: ${value}`)
          .join("\n") }],
      };
    }
  • TypeBox schema definition for GetFileInfoArgs, which requires a 'path' string parameter.
    export const GetFileInfoArgsSchema = Type.Object({
      path: Type.String(),
    });
    export type GetFileInfoArgs = Static<typeof GetFileInfoArgsSchema>;
  • index.ts:245-246 (registration)
    Registers the 'get_file_info' tool handler in the toolHandlers object, binding it to FastMCP execution with server context.
    get_file_info: (a: unknown) =>
      handleGetFileInfo(a, allowedDirectories, symlinksMap, noFollowSymlinks),
  • index.ts:311-311 (registration)
    Declares the tool metadata (name and description) in the allTools array used for conditional registration based on permissions.
    { name: "get_file_info", description: "Get file metadata" },
  • Utility function that retrieves and formats file statistics (size, dates, type, permissions) using fs.stat, used by the handler.
    export async function getFileStats(filePath: string): Promise<ImmutableFileInfo> {
      const stats = await fsPromises.stat(filePath);
      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),
      };
    }
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 key behavioral traits: it retrieves metadata (not content), returns comprehensive information (listing specific attributes), and has a constraint ('Only works within allowed directories'). However, it lacks details on error handling, rate limits, authentication needs, or what happens with invalid paths. For a tool with no annotations, this is adequate but leaves gaps in behavioral understanding.

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 supporting details. Every sentence adds value: the first defines the action, the second lists return information, the third distinguishes from content tools, and the fourth states a constraint. No wasted words, and it's appropriately sized for a single-parameter tool.

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 1 parameter, no annotations, and no output schema, the description is moderately complete. It covers the tool's purpose, key behaviors, and parameter semantics adequately. However, it lacks details on output format (e.g., structure of returned metadata), error cases, or integration with sibling tools. For a metadata retrieval tool, this is the minimum viable level, but more context on returns would improve completeness.

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 ('path') with 0% description coverage, so the description must compensate. It adds meaning by specifying that the path is for 'a file or directory' and implies it must be within allowed directories. This clarifies the parameter's purpose beyond the schema, though it doesn't detail path format or examples. With low schema coverage, the description does a good job of explaining the parameter's role.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Retrieve detailed metadata about a file or directory' with specific examples of what metadata is included (size, creation time, etc.). It distinguishes itself from content-reading tools like 'read_file' by emphasizing 'without reading the actual content.' However, it doesn't explicitly differentiate from similar metadata tools like 'get_permissions' or 'list_directory' beyond the scope of metadata.

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

Usage Guidelines3/5

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

The description provides some usage context: 'perfect for understanding file characteristics without reading the actual content' and 'Only works within allowed directories.' This implies when to use it (for metadata vs. content) and a constraint, but it doesn't explicitly guide when to choose this over alternatives like 'get_permissions' (which might focus only on permissions) or 'list_directory' (which might list files without detailed metadata). No explicit alternatives or exclusions are mentioned.

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

Related 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/rawr-ai/mcp-filesystem'

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