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
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Full file path (e.g., C:\Users\Node1\revenue-engine-mcp\index.js) |
Implementation Reference
- index.js:728-747 (handler)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; }
- index.js:541-554 (schema)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"] } },
- index.js:58-63 (helper)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) ); }