Skip to main content
Glama
softgridinc-pte-ltd

Excel Reader Server

read_excel_by_sheet_index

Extract data from a specific sheet in Excel files by specifying its index number. Reads the first sheet by default when no index is provided.

Instructions

Read content from a specific sheet by index in Excel (xlsx) files. Reads first sheet (index 0) if sheet_index not provided.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the Excel file
sheet_indexNoIndex of the sheet to read (optional, defaults to 0)

Implementation Reference

  • Executes the tool logic: retrieves sheet by index (default 0), validates index, reads all rows into list of lists with string values, stores in result dict.
    elif name == "read_excel_by_sheet_index":
        # Get sheet by index, default to 0 if not specified
        sheet_index = arguments.get("sheet_index", 0)
        if sheet_index < 0 or sheet_index >= len(workbook.sheetnames):
            raise ValueError(f"Sheet index {sheet_index} is out of range")
            
        sheet_name = workbook.sheetnames[sheet_index]
        sheet = workbook[sheet_name]
        sheet_data = []
        
        for row in sheet.rows:
            row_data = [str(cell.value) if cell.value is not None else "" for cell in row]
            sheet_data.append(row_data)
        
        result[sheet_name] = sheet_data
  • Input schema for the tool: requires file_path (string), optional sheet_index (integer >=0).
    types.Tool(
        name="read_excel_by_sheet_index",
        description="Read content from a specific sheet by index in Excel (xlsx) files. Reads first sheet (index 0) if sheet_index not provided.",
        inputSchema={
            "type": "object",
            "properties": {
                "file_path": {
                    "type": "string",
                    "description": "Path to the Excel file"
                },
                "sheet_index": {
                    "type": "integer",
                    "description": "Index of the sheet to read (optional, defaults to 0)",
                    "minimum": 0
                }
            },
            "required": ["file_path"]
        }
    )
  • The tool is registered by including it in the list returned by @server.list_tools() handler.
    return [
        types.Tool(
            name="read_excel",
            description="Read content from Excel (xlsx) files",
            inputSchema={
                "type": "object",
                "properties": {
                    "file_path": {
                        "type": "string",
                        "description": "Path to the Excel file"
                    }
                },
                "required": ["file_path"]
            }
        ),
        types.Tool(
            name="read_excel_by_sheet_name",
            description="Read content from a specific sheet by name in Excel (xlsx) files. Reads first sheet if sheet_name not provided.",
            inputSchema={
                "type": "object",
                "properties": {
                    "file_path": {
                        "type": "string",
                        "description": "Path to the Excel file"
                    },
                    "sheet_name": {
                        "type": "string",
                        "description": "Name of the sheet to read (optional, defaults to first sheet)"
                    }
                },
                "required": ["file_path"]
            }
        ),
        types.Tool(
            name="read_excel_by_sheet_index",
            description="Read content from a specific sheet by index in Excel (xlsx) files. Reads first sheet (index 0) if sheet_index not provided.",
            inputSchema={
                "type": "object",
                "properties": {
                    "file_path": {
                        "type": "string",
                        "description": "Path to the Excel file"
                    },
                    "sheet_index": {
                        "type": "integer",
                        "description": "Index of the sheet to read (optional, defaults to 0)",
                        "minimum": 0
                    }
                },
                "required": ["file_path"]
            }
        )
    ]
Behavior3/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. It discloses the default behavior (reads first sheet if sheet_index not provided), which is useful. However, it lacks details on error handling (e.g., invalid file paths or indices), output format, or performance considerations like file size limits.

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, well-structured sentence that efficiently conveys the tool's purpose, default behavior, and key distinction. Every word serves a purpose with no redundancy.

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

Completeness3/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 adequate for a simple read operation but incomplete. It covers the basic functionality and default, but lacks details on return values, error cases, or constraints like supported Excel versions, which would be helpful for an agent.

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 fully documents both parameters. The description adds minimal value beyond the schema by mentioning the default for sheet_index, but does not provide additional context like file format restrictions (xlsx only) or practical usage examples.

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

Purpose5/5

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

The description clearly states the specific action ('Read content'), resource ('from a specific sheet by index in Excel files'), and distinguishes from siblings by specifying 'by index' (vs. by name or general read). It explicitly mentions the default behavior for sheet_index.

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

Usage Guidelines4/5

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

The description provides clear context on when to use this tool (reading by sheet index) and implies alternatives through sibling tool names (read_excel_by_sheet_name for name-based reading). However, it does not explicitly state when NOT to use this tool or compare it directly to read_excel.

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/softgridinc-pte-ltd/mcp-excel-reader-server'

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