Skip to main content
Glama
ishayoyo

Excel MCP Server

by ishayoyo

get_range

Extract cell values from specified ranges in Excel or CSV files to access spreadsheet data for analysis or processing.

Instructions

Get values from a range of cells

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the CSV or Excel file
startCellYesStart cell in A1 notation (e.g., "A1")
endCellYesEnd cell in A1 notation (e.g., "D10")
sheetNoSheet name for Excel files (optional)

Implementation Reference

  • The core handler function implementing the get_range tool. Reads file content, parses A1 notation for start and end cells, validates the range, extracts the 2D array of values from the specified range, and returns formatted JSON response.
    async getRange(args: ToolArgs): Promise<ToolResponse> {
      try {
        const { filePath, startCell, endCell, sheet } = args;
        const data = await readFileContent(filePath, sheet);
        const start = parseA1Notation(startCell);
        const end = parseA1Notation(endCell);
    
        // Validate range
        if (start.row > end.row || start.col > end.col) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  success: false,
                  error: 'Invalid range: start cell must be before end cell',
                }, null, 2),
              },
            ],
          };
        }
    
        const rangeData = [];
        for (let row = start.row; row <= end.row && row < data.length; row++) {
          const rowData = [];
          for (let col = start.col; col <= end.col && col < (data[row]?.length || 0); col++) {
            rowData.push(data[row][col]);
          }
          rangeData.push(rowData);
        }
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: true,
                range: `${startCell}:${endCell}`,
                data: rangeData,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: false,
                error: error instanceof Error ? error.message : 'Unknown error occurred',
              }, null, 2),
            },
          ],
        };
      }
    }
  • Input schema definition for the get_range tool, specifying parameters like filePath, startCell, endCell, and sheet with types and requirements.
      name: 'get_range',
      description: 'Get values from a range of cells',
      inputSchema: {
        type: 'object',
        properties: {
          filePath: {
            type: 'string',
            description: 'Path to the CSV or Excel file',
          },
          startCell: {
            type: 'string',
            description: 'Start cell in A1 notation (e.g., "A1")',
          },
          endCell: {
            type: 'string',
            description: 'End cell in A1 notation (e.g., "D10")',
          },
          sheet: {
            type: 'string',
            description: 'Sheet name for Excel files (optional)',
          },
        },
        required: ['filePath', 'startCell', 'endCell'],
      },
    },
  • src/index.ts:1203-1205 (registration)
    Tool registration/dispatch in the MCP server request handler. Maps calls to 'get_range' to the DataOperationsHandler.getRange method.
    case 'get_range':
      return await this.dataOpsHandler.getRange(toolArgs);
    case 'get_headers':
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 'Get values' but does not specify whether this is a read-only operation, what happens with invalid ranges, if it requires file permissions, or the format of returned data. This leaves significant gaps in understanding the tool's behavior and limitations.

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 unnecessary words. It is front-loaded and wastes no space, making it easy to grasp quickly.

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 lack of annotations and output schema, the description is incomplete. It does not explain what the tool returns (e.g., data format, error handling) or behavioral aspects like performance or constraints. For a tool with 4 parameters and no structured output information, more context is needed to ensure proper usage.

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 description does not add meaning beyond the input schema, which has 100% coverage with clear descriptions for all parameters. Since the schema fully documents the parameters, the baseline score of 3 is appropriate, as the description neither compensates for gaps nor enhances understanding of the parameters.

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 action ('Get values') and resource ('from a range of cells'), making the purpose understandable. However, it does not distinguish this tool from similar siblings like 'get_cell' or 'read_file', which might also retrieve data from files, leaving some ambiguity about its specific role.

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 'get_cell', 'read_file', and 'filter_rows' that might overlap in functionality, there is no indication of context, prerequisites, or exclusions for using 'get_range'.

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