Skip to main content
Glama
ishayoyo

Excel MCP Server

by ishayoyo

export_analysis

Export Excel analysis results like pivot tables and statistics to a new file for sharing or further processing.

Instructions

Export analysis results (pivot tables, statistics, etc.) to a new file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analysisTypeYesType of analysis to export
sourceFileYesPath to the source data file
outputFileYesPath for the output file
analysisParamsYesParameters for the analysis (depends on analysisType)

Implementation Reference

  • The exportAnalysis method implements the core logic of the 'export_analysis' tool. It processes different analysis types (pivot_table, statistical_analysis), prepares tabular data, writes it to an output file using the internal writeFile method, and returns a success response with export details.
    async exportAnalysis(args: ToolArgs): Promise<ToolResponse> {
      const { analysisType, sourceFile, outputFile, analysisParams } = args;
    
      let exportData: any[][] = [];
    
      switch (analysisType) {
        case 'pivot_table': {
          // This would need to call the analytics handler - simplified for now
          exportData = [
            ['Group', 'Value', 'Count'],
            // Results would go here
          ];
          break;
        }
    
        case 'statistical_analysis': {
          exportData = [
            ['Metric', 'Value'],
            ['Column', 'Sample Column'],
            // Statistical results would go here
          ];
          break;
        }
    
        // Add other analysis types as needed
        default:
          throw new Error(`Unsupported analysis type: ${analysisType}`);
      }
    
      // Write the analysis results to file
      await this.writeFile({
        filePath: outputFile,
        data: exportData.slice(1), // Remove headers
        headers: exportData[0] // Use first row as headers
      });
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              analysisType,
              sourceFile,
              outputFile,
              rowsExported: exportData.length,
            }, null, 2),
          },
        ],
      };
    }
  • The tool schema definition for 'export_analysis' including name, description, and detailed inputSchema specifying parameters like analysisType, sourceFile, outputFile, and analysisParams.
      name: 'export_analysis',
      description: 'Export analysis results (pivot tables, statistics, etc.) to a new file',
      inputSchema: {
        type: 'object',
        properties: {
          analysisType: {
            type: 'string',
            description: 'Type of analysis to export',
            enum: ['pivot_table', 'statistical_analysis', 'correlation', 'data_profile'],
          },
          sourceFile: {
            type: 'string',
            description: 'Path to the source data file',
          },
          outputFile: {
            type: 'string',
            description: 'Path for the output file',
          },
          analysisParams: {
            type: 'object',
            description: 'Parameters for the analysis (depends on analysisType)',
          },
        },
        required: ['analysisType', 'sourceFile', 'outputFile', 'analysisParams'],
      },
    },
  • src/index.ts:1249-1251 (registration)
    Registration of the 'export_analysis' tool in the MCP server's CallToolRequestHandler switch statement, mapping the tool name to the FileOperationsHandler's exportAnalysis method.
    case 'export_analysis':
      return await this.fileOpsHandler.exportAnalysis(toolArgs);
    case 'format_cells':
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 exports to a 'new file', implying a write operation, but does not cover critical aspects like file format, overwrite behavior, permissions needed, error handling, or rate limits. This is inadequate for a tool with no annotation coverage.

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 front-loads the core action ('export analysis results') and includes helpful examples ('pivot tables, statistics, etc.'). There is no wasted wording, making it appropriately concise and well-structured.

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 no annotations and no output schema, the description is incomplete for a tool with 4 parameters and nested objects. It lacks details on behavioral traits, output format, error conditions, and how it differs from sibling tools, making it insufficient for an agent to use effectively without additional context.

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 adds minimal value by implying the tool handles 'analysis results' but does not provide additional context or meaning beyond what the schema specifies, such as how 'analysisParams' relates to 'analysisType'. Baseline 3 is appropriate here.

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 verb 'export' and the resource 'analysis results' with examples like 'pivot tables, statistics, etc.', making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'write_file' or 'bulk_aggregate_multi_files', which might also involve file output, so it lacks sibling differentiation for a perfect score.

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, such as 'write_file' for general file writing or specific analysis tools like 'pivot_table'. There is no mention of prerequisites, context, or exclusions, leaving the agent with minimal usage direction.

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