Skip to main content
Glama

get_file_info

Retrieve file metadata including size, timestamps, type, and permissions without accessing file contents. Use to inspect file properties for system management and analysis.

Instructions

Retrieve detailed metadata about a file or directory, including size, creation time, modification time, access time, type, and permissions. This does not read file contents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe path to the file/directory

Implementation Reference

  • Handler implementation for 'get_file_info' tool. Uses fs.stat to get file/directory stats and returns JSON metadata including path, type, size, timestamps, permissions.
    case "get_file_info": { const filePath = args.path as string; const stats = await fs.stat(filePath); const info = { path: filePath, type: stats.isDirectory() ? "directory" : stats.isFile() ? "file" : "other", size: stats.size, created: stats.birthtime.toISOString(), modified: stats.mtime.toISOString(), accessed: stats.atime.toISOString(), permissions: stats.mode.toString(8).slice(-3), isReadable: fsSync.constants.R_OK, isWritable: fsSync.constants.W_OK, }; return { content: [ { type: "text", text: JSON.stringify(info, null, 2), }, ], }; }
  • src/index.ts:158-171 (registration)
    Tool registration in TOOLS array, defining name, description, and input schema for 'get_file_info' (used for listTools response).
    { name: "get_file_info", description: "Retrieve detailed metadata about a file or directory, including size, creation time, modification time, access time, type, and permissions. This does not read file contents.", inputSchema: { type: "object", properties: { path: { type: "string", description: "The path to the file/directory", }, }, required: ["path"], }, },

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/koopatroopa787/first_mcp'

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