Skip to main content
Glama
koopatroopa787

MCP PC Control Server

get_file_info

Retrieve file metadata including size, timestamps, type, and permissions without reading file contents. Use this tool to inspect file details on your PC.

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 function for get_file_info tool that retrieves file stats using fs.stat and returns formatted JSON with file metadata including type, size, timestamps, and 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),
          },
        ],
      };
    }
  • Tool schema definition including name, description, and input schema requiring a 'path' parameter.
    {
      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"],
      },
    },
  • src/index.ts:261-263 (registration)
    Registration of listTools handler that returns the TOOLS array containing get_file_info.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools: 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/koopatroopa787/first_mcp'

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