Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

fs_get_file_info

Retrieve detailed file or directory information including size, permissions, and timestamps for development environment analysis.

Instructions

Get detailed information about a file or directory (size, permissions, timestamps, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute or relative path to the file or directory

Implementation Reference

  • The handler function that implements the core logic for 'fs_get_file_info', using fs.stat and fs.realpath to fetch file stats and returning formatted JSON response.
    export async function getFileInfo(args: z.infer<typeof getFileInfoSchema>): Promise<ToolResponse> { try { const stats = await fs.stat(args.path); const realPath = await fs.realpath(args.path); return { content: [ { type: "text" as const, text: JSON.stringify({ success: true, path: args.path, realPath: realPath, type: stats.isDirectory() ? 'directory' : stats.isSymbolicLink() ? 'symlink' : 'file', size: stats.size, created: stats.birthtime, modified: stats.mtime, accessed: stats.atime, permissions: stats.mode.toString(8), uid: stats.uid, gid: stats.gid }, null, 2) } ] }; } catch (error) { return { content: [ { type: "text" as const, text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : String(error) }, null, 2) } ], isError: true }; } }
  • Zod input validation schema used for parsing arguments before calling the handler.
    export const getFileInfoSchema = z.object({ path: z.string().describe('Absolute or relative path to the file or directory') });
  • src/index.ts:333-336 (registration)
    Registration and dispatch in the main MCP CallToolRequest handler, matching tool name and invoking the validated handler.
    if (name === 'fs_get_file_info') { const validated = getFileInfoSchema.parse(args); return await getFileInfo(validated); }
  • MCP tool metadata definition including JSON inputSchema, used for tool listing and discovery.
    { name: 'fs_get_file_info', description: 'Get detailed information about a file or directory (size, permissions, timestamps, etc.)', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Absolute or relative path to the file or 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/ConnorBoetig-dev/mcp2'

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