Skip to main content
Glama
ishayoyo

Excel MCP Server

by ishayoyo

dcf_analysis

Perform Discounted Cash Flow valuation analysis to evaluate investment opportunities using cash flow data from Excel or CSV files.

Instructions

Perform Discounted Cash Flow (DCF) valuation analysis for investment evaluation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the CSV or Excel file with cash flow data
sheetNoSheet name for Excel files (optional)
assumptionsNoDCF assumptions (optional)

Implementation Reference

  • The core handler function that implements the DCF analysis tool. It reads file data, applies default or provided assumptions, generates projected cash flows, computes NPV using HyperFormula engine, calculates terminal and enterprise value, and returns structured results or error.
    async dcfAnalysis(args: ToolArgs): Promise<ToolResponse> {
      const { filePath, sheet, assumptions = {} } = args;
    
      try {
        const data = await readFileContent(filePath, sheet);
    
        // Default DCF assumptions
        const dcfParams = {
          initialInvestment: assumptions.initialInvestment || -1000000,
          growthRate: assumptions.growthRate || 0.15,
          discountRate: assumptions.discountRate || 0.12,
          terminalMultiple: assumptions.terminalMultiple || 8,
          projectionYears: assumptions.projectionYears || 5,
          ...assumptions
        };
    
        // Generate cash flow projections
        const cashFlows = [];
        let revenue = assumptions.startingRevenue || 1000000;
    
        for (let year = 1; year <= dcfParams.projectionYears; year++) {
          revenue *= (1 + dcfParams.growthRate);
          const cashFlow = revenue * 0.2; // 20% margin simplified
          cashFlows.push(cashFlow);
        }
    
        // Calculate NPV
        const npvFormula = `NPV(${dcfParams.discountRate}, ${cashFlows.join(',')})`;
        const mockContext: WorkbookContext = {
          getCellValue: () => 0,
          getNamedRangeValue: () => 0,
          getRangeValues: () => [],
          getSheetCellValue: () => 0,
          getSheetRangeValues: () => []
        };
        const npv = hyperFormulaEngine.evaluateFormula(npvFormula, mockContext);
    
        // Terminal value
        const terminalValue = cashFlows[cashFlows.length - 1] * dcfParams.terminalMultiple;
        const enterpriseValue = (typeof npv === 'number' ? npv : 0) + terminalValue + Math.abs(dcfParams.initialInvestment);
    
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              success: true,
              model: 'DCF Analysis',
              assumptions: dcfParams,
              projections: {
                cashFlows,
                npv,
                terminalValue,
                enterpriseValue
              },
              valuation: {
                enterpriseValue,
                equityValue: enterpriseValue, // Simplified
                valuePerShare: enterpriseValue / 1000000 // Simplified
              }
            }, null, 2)
          }]
        };
    
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              success: false,
              error: error instanceof Error ? error.message : 'Unknown error',
              operation: 'dcf_analysis'
            }, null, 2)
          }]
        };
      }
    }
  • The input schema definition for the dcf_analysis tool, defining parameters like filePath (required), sheet, and optional assumptions object with DCF-specific properties.
    name: 'dcf_analysis',
    description: 'Perform Discounted Cash Flow (DCF) valuation analysis for investment evaluation',
    inputSchema: {
      type: 'object',
      properties: {
        filePath: {
          type: 'string',
          description: 'Path to the CSV or Excel file with cash flow data'
        },
        sheet: {
          type: 'string',
          description: 'Sheet name for Excel files (optional)'
        },
        assumptions: {
          type: 'object',
          description: 'DCF assumptions (optional)',
          properties: {
            initialInvestment: { type: 'number', description: 'Initial investment amount (negative)' },
            growthRate: { type: 'number', description: 'Annual growth rate (0.15 = 15%)' },
            discountRate: { type: 'number', description: 'Discount rate/WACC (0.12 = 12%)' },
            terminalMultiple: { type: 'number', description: 'Terminal value multiple (8x)' },
            projectionYears: { type: 'number', description: 'Number of projection years' }
          }
        }
      },
      required: ['filePath']
    }
  • src/index.ts:1231-1240 (registration)
    The switch case registration that maps the 'dcf_analysis' tool call to the financialHandler.dcfAnalysis method in the MCP server request handler.
    case 'dcf_analysis':
      return await this.financialHandler.dcfAnalysis(toolArgs);
    case 'budget_variance_analysis':
      return await this.financialHandler.budgetVarianceAnalysis(toolArgs);
    case 'ratio_analysis':
      return await this.financialHandler.ratioAnalysis(toolArgs);
    case 'scenario_modeling':
      return await this.financialHandler.scenarioModeling(toolArgs);
    case 'trend_analysis':
      return await this.financialHandler.trendAnalysis(toolArgs);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool performs DCF analysis but doesn't describe what the tool actually does behaviorally: e.g., whether it modifies files, requires specific permissions, outputs results to a file or console, handles errors, or has performance constraints like rate limits. For a tool with no annotations and complex financial calculations, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without redundancy. It's appropriately sized for a tool with a clear name and well-documented schema, and it's front-loaded with the core function. There's no wasted verbiage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of DCF analysis (involving financial modeling), no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like what the tool returns (e.g., a valuation figure, a report, or an error), how it processes the file, or any limitations. For a tool with nested parameters and no structured output documentation, more context is needed to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description doesn't add any semantic context beyond what's in the schema—it doesn't explain how parameters interact (e.g., how assumptions apply to the cash flow data) or provide usage examples. With high schema coverage, the baseline score of 3 is appropriate, as the description adds no extra parameter value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Perform Discounted Cash Flow (DCF) valuation analysis for investment evaluation.' It specifies the verb ('perform') and resource ('Discounted Cash Flow valuation analysis'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'budget_variance_analysis' or 'scenario_modeling' that might also involve financial analysis.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing cash flow data files), exclusions (e.g., not for real-time data), or comparisons to sibling tools like 'ratio_analysis' or 'trend_analysis'. The agent must infer usage from the tool name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ishayoyo/excel-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server