excel_save_file
Save Excel workbooks containing financial calculations, investment analysis, and automated reports to specified file paths for secure storage and sharing.
Instructions
Save the current workbook to a file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | No |
Implementation Reference
- src/tools/excel-tools.ts:85-107 (handler)The handler implementation for the 'excel_save_file' tool. It takes a filePath argument and calls ExcelManager.saveWorkbook to save the current workbook, returning success or error status.{ name: "excel_save_file", description: "Save the current workbook to a file", inputSchema: { type: "object", properties: { filePath: { type: "string" } } }, handler: async (args: any): Promise<ToolResult> => { try { await excelManager.saveWorkbook(args.filePath); return { success: true, message: `Saved workbook to ${args.filePath || 'current file'}` }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }
- src/tools/excel-tools.ts:88-93 (schema)The input schema for 'excel_save_file' tool requiring a filePath string.inputSchema: { type: "object", properties: { filePath: { type: "string" } } },
- src/index.ts:32-44 (registration)Registration of all tools including excelTools (which contains excel_save_file) into the allTools array used by the MCP server for listing and calling tools.const allTools = [ ...excelTools, ...financialTools, ...rentalTools, ...expenseTools, ...reportingTools, ...cashFlowTools, ...taxTools, ...analyticsTools, ...chartTools, ...complianceTools, ...propertyTools, ];
- src/excel/excel-manager.ts:75-94 (helper)The ExcelManager.saveWorkbook helper method that performs the actual file saving using ExcelJS, ensuring formulas calculate on load.async saveWorkbook(filePath?: string): Promise<void> { if (!this.workbook) { throw new Error('No workbook is currently open'); } const savePath = filePath || this.currentFile; if (!savePath) { throw new Error('No file path specified'); } // Ensure formulas are calculated when the file is opened this.workbook.calcProperties = { fullCalcOnLoad: true }; await this.workbook.xlsx.writeFile(savePath); if (!this.currentFile || this.currentFile !== savePath) { this.currentFile = savePath; } }
- src/tools/excel-tools.ts:6-6 (helper)Instantiation of the ExcelManager instance used by all excel tools including excel_save_file.const excelManager = new ExcelManager();