excel_create_npv_analysis
Generate Excel worksheets with formulas to calculate Net Present Value for investment analysis and financial decision-making.
Instructions
Create a comprehensive NPV analysis worksheet with formulas and documentation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| discountRate | Yes | Annual discount rate (e.g., 0.10 for 10%) | |
| projectName | Yes | ||
| worksheetName | No | NPV Analysis |
Implementation Reference
- src/tools/excel-tools.ts:599-636 (handler)Primary tool handler for excel_create_npv_analysis. Defines schema, description, and execution logic which delegates worksheet generation to ProfessionalTemplates.createNPVAnalysisWorksheet.{ name: "excel_create_npv_analysis", description: "Create a comprehensive NPV analysis worksheet with formulas and documentation", inputSchema: { type: "object", properties: { projectName: { type: "string" }, discountRate: { type: "number", description: "Annual discount rate (e.g., 0.10 for 10%)" }, worksheetName: { type: "string", default: "NPV Analysis" } }, required: ["projectName", "discountRate"] }, handler: async (args: any): Promise<ToolResult> => { try { const worksheetData = ProfessionalTemplates.createNPVAnalysisWorksheet(args.projectName, args.discountRate); const worksheetName = args.worksheetName || "NPV Analysis"; await excelManager.addWorksheet(worksheetName); await excelManager.writeWorksheet(worksheetName, worksheetData.data); await excelManager.autoFitColumnWidths(worksheetName, { minWidth: 80, maxWidth: 250 }); return { success: true, message: `Created NPV analysis worksheet for ${args.projectName}`, data: { worksheetName, discountRate: args.discountRate, projectName: args.projectName } }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
- Core helper function that generates the detailed NPV analysis worksheet data structure, including headers, assumptions, cash flow table with PV formulas, NPV summary, decision criteria (IRR, Profitability Index), and GAAP references.static createNPVAnalysisWorksheet(projectName: string, discountRate: number): WorksheetData { return { name: 'NPV Analysis', data: [ ['NPV ANALYSIS - ' + projectName.toUpperCase(), '', '', '', '', ''], ['Prepared by Excel Finance MCP', '', '', '', '', ''], ['Date: ' + new Date().toLocaleDateString(), '', '', '', '', ''], ['', '', '', '', '', ''], ['ASSUMPTIONS:', '', '', '', '', ''], ['Discount Rate (WACC):', { formula: `=${discountRate}`, value: null }, 'Cell: B6', 'Formula: User Input', 'Standard: GAAP Cost of Capital', 'Reference: https://www.fasb.org/standards/'], ['', '', '', '', '', ''], ['CASH FLOW PROJECTION:', '', '', '', '', ''], ['Year', 'Cash Flow', 'PV Factor', 'Present Value', 'Cumulative PV', 'Documentation'], ['0', { formula: '=C11', value: null }, '1.00', { formula: '=B10*C10', value: null }, { formula: '=D10', value: null }, 'Initial Investment (negative)'], ['1', { formula: '=C12', value: null }, { formula: '=1/(1+$B$6)^A11', value: null }, { formula: '=B11*C11', value: null }, { formula: '=E10+D11', value: null }, 'Year 1 net cash flow'], ['2', { formula: '=C13', value: null }, { formula: '=1/(1+$B$6)^A12', value: null }, { formula: '=B12*C12', value: null }, { formula: '=E11+D12', value: null }, 'Year 2 net cash flow'], ['3', { formula: '=C14', value: null }, { formula: '=1/(1+$B$6)^A13', value: null }, { formula: '=B13*C13', value: null }, { formula: '=E12+D13', value: null }, 'Year 3 net cash flow'], ['4', { formula: '=C15', value: null }, { formula: '=1/(1+$B$6)^A14', value: null }, { formula: '=B14*C14', value: null }, { formula: '=E13+D14', value: null }, 'Year 4 net cash flow'], ['5', { formula: '=C16', value: null }, { formula: '=1/(1+$B$6)^A15', value: null }, { formula: '=B15*C15', value: null }, { formula: '=E14+D15', value: null }, 'Year 5 net cash flow + terminal value'], ['', '', '', '', '', ''], ['NET PRESENT VALUE:', { formula: '=SUM(D10:D15)', value: null }, '', 'Formula: =SUM(PresentValues)', 'Standard: FASB Concept 7', 'https://www.fasb.org/concepts/'], ['', '', '', '', '', ''], ['INVESTMENT DECISION:', '', '', '', '', ''], ['NPV Result:', { formula: '=IF(D17>0,"ACCEPT - Positive NPV","REJECT - Negative NPV")', value: '' }, '', 'Accept if NPV > 0', 'GAAP Investment Criteria', ''], ['IRR:', { formula: '=IRR(B10:B15)', value: null }, '', 'Compare to discount rate', 'Accept if IRR > WACC', ''], ['Profitability Index:', { formula: '=D17/ABS(B10)', value: null }, '', 'PI = NPV / Initial Investment', 'Accept if PI > 1.0', ''], ['', '', '', '', '', ''], ['INPUT SECTION (Update these cells):', '', '', '', '', ''], ['Initial Investment:', { formula: '=-100000', value: null }, '', 'Enter negative amount', '', ''], ['Year 1 Cash Flow:', { formula: '=25000', value: null }, '', 'Operating cash flow projection', '', ''], ['Year 2 Cash Flow:', { formula: '=30000', value: null }, '', 'Operating cash flow projection', '', ''], ['Year 3 Cash Flow:', { formula: '=35000', value: null }, '', 'Operating cash flow projection', '', ''], ['Year 4 Cash Flow:', { formula: '=40000', value: null }, '', 'Operating cash flow projection', '', ''], ['Year 5 Cash Flow + Terminal:', { formula: '=250000', value: null }, '', 'Final year + terminal value', '', ''] ] }; }
- src/index.ts:32-44 (registration)Registration of all tools including excelTools (which contains excel_create_npv_analysis) into the main allTools array used by MCP server handlers.const allTools = [ ...excelTools, ...financialTools, ...rentalTools, ...expenseTools, ...reportingTools, ...cashFlowTools, ...taxTools, ...analyticsTools, ...chartTools, ...complianceTools, ...propertyTools, ];
- src/tools/excel-tools.ts:602-610 (schema)Input schema defining parameters for the excel_create_npv_analysis tool.inputSchema: { type: "object", properties: { projectName: { type: "string" }, discountRate: { type: "number", description: "Annual discount rate (e.g., 0.10 for 10%)" }, worksheetName: { type: "string", default: "NPV Analysis" } }, required: ["projectName", "discountRate"] },