Skip to main content
Glama

read_file

Access file contents from designated directories to support revenue tracking and business management workflows in Google Workspace.

Instructions

Read contents of a file. Only works in allowed directories: revenue-engine-mcp, apps-script folders

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFull file path (e.g., C:\Users\Node1\revenue-engine-mcp\index.js)

Implementation Reference

  • The handler for the 'read_file' tool. Validates the input path using isPathAllowed, checks if the file exists, reads the file content synchronously using fs.readFileSync, and returns a structured response with success status, path, content, and size.
    case "read_file": {
      const { path } = args;
      
      if (!isPathAllowed(path)) {
        throw new Error(`Access denied: Path not in allowed directories`);
      }
    
      if (!fs.existsSync(path)) {
        throw new Error(`File not found: ${path}`);
      }
    
      const content = fs.readFileSync(path, 'utf8');
      result = {
        success: true,
        path: path,
        content: content,
        size: content.length
      };
      break;
    }
  • The input schema definition for the 'read_file' tool, specifying the required 'path' parameter as a string, listed in the tools response for ListToolsRequest.
    {
      name: "read_file",
      description: "Read contents of a file. Only works in allowed directories: revenue-engine-mcp, apps-script folders",
      inputSchema: {
        type: "object",
        properties: {
          path: { 
            type: "string", 
            description: "Full file path (e.g., C:\\Users\\Node1\\revenue-engine-mcp\\index.js)" 
          }
        },
        required: ["path"]
      }
    },
  • Helper function used by read_file (and other FS tools) to check if the provided path is within allowed directories, preventing access to unauthorized files.
    function isPathAllowed(filePath) {
      const normalized = filePath.replace(/\//g, '\\');
      return ALLOWED_PATHS.some(allowedPath => 
        normalized.startsWith(allowedPath)
      );
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds useful context about directory restrictions, which is not in the schema, but lacks details on permissions, error handling, or output format (e.g., text, binary). This is adequate but has clear gaps for a read operation tool.

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 and adds necessary constraints in the second. Both sentences earn their place by providing essential information without redundancy, making it efficient and well-structured.

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 minimally complete for a simple read tool with one parameter. It covers the action and constraints but lacks details on return values or error cases, which could be important for agent invocation. This is adequate but not comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the 'path' parameter fully documented in the schema. The description adds no additional parameter details beyond implying path constraints via allowed directories, which is minimal value. Baseline 3 is appropriate as the schema does the heavy lifting.

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 ('Read contents') and resource ('a file'), distinguishing it from sibling tools like 'edit_file' or 'write_file' which modify files. It also specifies the scope ('Only works in allowed directories'), making the purpose unambiguous and distinct.

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 on when to use this tool by specifying the allowed directories ('revenue-engine-mcp, apps-script folders'), which helps guide usage. However, it does not explicitly mention when not to use it or name alternatives like 'get_email_content' for different file types, leaving some gaps in comparative guidance.

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/PromptishOperations/mcpSpec'

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