read_file
Access file contents from revenue-engine-mcp and apps-script directories to support revenue tracking, lead management, and business operations through Google Sheets, Gmail, and Calendar integration.
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)Handler implementation for the 'read_file' tool. Validates path permissions, checks file existence, reads file content using fs.readFileSync, and returns structured result.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 (registration)Registration of the 'read_file' tool in the ListTools response, including name, description, and input schema definition.{ 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 file tools) to validate if the requested path is within allowed directories.function isPathAllowed(filePath) { const normalized = filePath.replace(/\//g, '\\'); return ALLOWED_PATHS.some(allowedPath => normalized.startsWith(allowedPath) ); }
- index.js:29-33 (helper)Configuration of allowed directories for file operations, used by isPathAllowed helper.const ALLOWED_PATHS = [ 'C:\\Users\\Node1\\revenue-engine-mcp', 'C:\\Users\\Node1\\Documents\\revenue-engine\\mcp-server', 'C:\\Users\\Node1\\Documents\\revenue-engine\\apps-script', ];