Skip to main content
Glama
ishayoyo

Excel MCP Server

by ishayoyo

smart_data_analysis

Analyze Excel or CSV data with AI-powered insights and suggestions to identify patterns, trends, and actionable information from your datasets.

Instructions

AI-powered analysis suggestions for your data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the CSV or Excel file to analyze
sheetNoSheet name for Excel files (optional)
providerNoPreferred AI provider: anthropic, openai, deepseek, gemini, or local (optional)

Implementation Reference

  • Core implementation of the smart_data_analysis tool handler. Reads file content, builds worksheet context, detects data types, generates AI formula suggestions via NLPProcessor.suggestFormulas, and returns structured response.
    async smartDataAnalysis(args: ToolArgs): Promise<ToolResponse> {
      const { filePath, sheet, provider } = args;
    
      try {
        // Read the file
        const data = await readFileContent(filePath, sheet);
    
        if (data.length === 0) {
          throw new Error('File is empty');
        }
    
        // Create context for AI analysis
        const context = {
          headers: data[0],
          rowCount: data.length,
          columnCount: data[0]?.length || 0,
          dataTypes: detectDataTypes(data),
          sampleData: data.slice(0, 6), // First 5 data rows + header
          activeCell: 'A1',
          selectedRange: 'A1:A1'
        };
    
        // Generate AI suggestions
        const suggestions = await this.nlpProcessor.suggestFormulas(context);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                filePath,
                context: {
                  headers: context.headers,
                  rowCount: context.rowCount,
                  columnCount: context.columnCount,
                  dataTypes: context.dataTypes
                },
                aiSuggestions: suggestions,
                success: true,
                provider: this.nlpProcessor.getActiveProvider()?.name || 'Local'
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                filePath,
                error: error instanceof Error ? error.message : 'Unknown error',
                success: false
              }, null, 2),
            },
          ],
        };
      }
    }
  • Tool schema definition in ListToolsRequestSchema, specifying input parameters: filePath (required), sheet, and provider.
      name: 'smart_data_analysis',
      description: 'AI-powered analysis suggestions for your data',
      inputSchema: {
        type: 'object',
        properties: {
          filePath: {
            type: 'string',
            description: 'Path to the CSV or Excel file to analyze',
          },
          sheet: {
            type: 'string',
            description: 'Sheet name for Excel files (optional)',
          },
          provider: {
            type: 'string',
            description: 'Preferred AI provider: anthropic, openai, deepseek, gemini, or local (optional)',
            enum: ['anthropic', 'openai', 'deepseek', 'gemini', 'local'],
          },
        },
        required: ['filePath'],
      },
    },
  • src/index.ts:1265-1266 (registration)
    Tool registration in CallToolRequestSchema switch statement, dispatching calls to AIOperationsHandler.smartDataAnalysis method.
    case 'smart_data_analysis':
      return await this.aiOpsHandler.smartDataAnalysis(toolArgs);
  • Supporting helper method in NLPProcessor that generates formula suggestions based on data patterns (numeric columns, dates), used by the handler for AI analysis.
    async suggestFormulas(context: WorksheetContext): Promise<FormulaIntent[]> {
      const suggestions: FormulaIntent[] = [];
      
      // Analyze data patterns
      const patterns = this.analyzeDataPatterns(context);
      
      // Generate suggestions based on patterns
      if (patterns.hasNumbers) {
        suggestions.push({
          formula: `=SUM(${patterns.numericColumns[0]}:${patterns.numericColumns[0]})`,
          explanation: 'Sum all values in the column',
          references: patterns.numericColumns
        });
        
        suggestions.push({
          formula: `=AVERAGE(${patterns.numericColumns[0]}:${patterns.numericColumns[0]})`,
          explanation: 'Calculate the average of all values',
          references: patterns.numericColumns
        });
      }
      
      if (patterns.hasDates && patterns.hasNumbers) {
        suggestions.push({
          formula: `=SUMIFS(${patterns.numericColumns[0]}:${patterns.numericColumns[0]}, ${patterns.dateColumns[0]}:${patterns.dateColumns[0]}, ">="&TODAY()-30)`,
          explanation: 'Sum values from the last 30 days',
          references: [...patterns.numericColumns, ...patterns.dateColumns]
        });
      }
      
      return suggestions;
    }
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 mentions 'AI-powered analysis suggestions' but doesn't explain what this entails—such as whether it performs data processing, requires specific permissions, has rate limits, or what the output looks like. For a tool with no annotation coverage, this is a significant gap in transparency.

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

Conciseness4/5

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

The description is a single, efficient sentence: 'AI-powered analysis suggestions for your data'. It is front-loaded and wastes no words, making it appropriately concise. However, it could be more structured by including key details upfront, but it earns high marks for brevity.

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 AI-powered analysis, no annotations, and no output schema, the description is incomplete. It doesn't explain what 'analysis suggestions' entail, the format of results, or any behavioral traits like error handling. For a tool with 3 parameters and rich sibling context, this leaves significant gaps in understanding its full functionality.

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?

The schema description coverage is 100%, meaning all parameters are documented in the input schema. The description adds no additional meaning beyond the schema, such as explaining how 'filePath' relates to data analysis or the implications of choosing different 'provider' options. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't detract.

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

Purpose3/5

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

The description states the tool provides 'AI-powered analysis suggestions for your data', which indicates its general purpose but lacks specificity. It mentions 'analysis suggestions' rather than a concrete action like 'generate insights' or 'identify patterns', and doesn't distinguish from siblings like 'statistical_analysis' or 'correlation_analysis' that might offer similar analytical functions. This makes the purpose somewhat vague.

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. With many sibling tools like 'statistical_analysis', 'correlation_analysis', and 'data_profile' that might overlap in analytical capabilities, there is no indication of context, prerequisites, or exclusions. This leaves the agent without clear usage instructions.

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