excel_open_file
Access Excel files for financial analysis, investment calculations, expense tracking, and automated reporting using advanced formulas and projections.
Instructions
Open an existing Excel file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes |
Implementation Reference
- src/tools/excel-tools.ts:69-82 (handler)The main handler function for the 'excel_open_file' tool. It calls ExcelManager.openWorkbook with the provided filePath and returns file information or an error.handler: async (args: any): Promise<ToolResult> => { try { const fileInfo = await excelManager.openWorkbook(args.filePath); return { success: true, data: fileInfo }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }
- src/tools/excel-tools.ts:62-68 (schema)Input schema defining the required 'filePath' parameter as a string.inputSchema: { type: "object", properties: { filePath: { type: "string" } }, required: ["filePath"] },
- src/excel/excel-manager.ts:60-73 (helper)Core helper method in ExcelManager that loads the Excel file using ExcelJS, sets the current workbook, retrieves file stats, and returns metadata including worksheets list.async openWorkbook(filePath: string): Promise<ExcelFileInfo> { this.workbook = new ExcelJS.Workbook(); await this.workbook.xlsx.readFile(filePath); this.currentFile = filePath; const stats = await fs.stat(filePath); return { path: filePath, worksheets: this.workbook.worksheets.map(ws => ws.name), lastModified: stats.mtime, size: stats.size }; }
- src/index.ts:32-44 (registration)Registration of all tools by spreading excelTools (which contains excel_open_file) into the central allTools array used for MCP tool listing and execution.const allTools = [ ...excelTools, ...financialTools, ...rentalTools, ...expenseTools, ...reportingTools, ...cashFlowTools, ...taxTools, ...analyticsTools, ...chartTools, ...complianceTools, ...propertyTools, ];
- src/tools/excel-tools.ts:59-83 (registration)Tool object definition exported as part of excelTools array, which is imported and registered in src/index.ts.{ name: "excel_open_file", description: "Open an existing Excel file", inputSchema: { type: "object", properties: { filePath: { type: "string" } }, required: ["filePath"] }, handler: async (args: any): Promise<ToolResult> => { try { const fileInfo = await excelManager.openWorkbook(args.filePath); return { success: true, data: fileInfo }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },