Skip to main content
Glama
marekrost

mcp-server-spreadsheet

read_range

Extract specific cell data from spreadsheet files by defining a rectangular range. Returns values as a structured 2D array with empty cells as null.

Instructions

Read a rectangular range of cells as a list of rows.

Returns a 2D array where each inner list is one row of values. Empty cells return null.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the spreadsheet file
range_strYesCell range in A1 notation, e.g. 'A1:D10' or '$A$1:$D$10'
sheetNoSheet name. Defaults to the first sheet if omitted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Implementation of the 'read_range' tool handler, which uses the mcp.tool decorator and interacts with openpyxl to read a spreadsheet range.
    @mcp.tool()
    def read_range(
        file: Annotated[str, Field(description="Path to the spreadsheet file")],
        range_str: Annotated[str, Field(description="Cell range in A1 notation, e.g. 'A1:D10' or '$A$1:$D$10'")],
        sheet: Annotated[str | None, Field(description="Sheet name. Defaults to the first sheet if omitted.")] = None,
    ) -> list[list]:
        """Read a rectangular range of cells as a list of rows.
    
        Returns a 2D array where each inner list is one row of values.
        Empty cells return null.
        """
        wb = load_workbook(file)
        ws = _resolve_sheet(wb, sheet)
        min_col, min_row, max_col, max_row = parse_range(range_str)
        rows = ws.iter_rows(
            min_row=min_row,
            max_row=max_row,
            min_col=min_col,
            max_col=max_col,
        )
        return [list(r) for r in rows]
Behavior4/5

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

With no annotations provided, the description carries the full burden. It effectively discloses key behavioral traits: the return format (2D array with rows as inner lists), handling of empty cells (null), and the rectangular nature of the range. However, it doesn't cover error conditions, permissions, or performance aspects.

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 front-loaded with the core purpose in the first sentence, followed by essential details about return format and empty cell handling. Every sentence earns its place with zero waste, making it highly efficient.

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

Completeness5/5

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

Given the tool's moderate complexity, 100% schema coverage, and the presence of an output schema (which handles return values), the description is complete enough. It covers purpose, behavior, and output structure without needing to duplicate schema information.

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 no additional parameter semantics beyond what's in the schema, meeting the baseline for high coverage without extra value.

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 a rectangular range of cells') and resource ('cells'), distinguishing it from siblings like read_cell (single cell) and read_sheet (entire sheet). It precisely defines the operation without being vague or tautological.

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

Usage Guidelines3/5

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

Usage is implied by the description's focus on reading cell ranges, but there's no explicit guidance on when to use this tool versus alternatives like read_cell (for single cells) or read_sheet (for entire sheets). It doesn't mention prerequisites or exclusions.

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/marekrost/mcp-server-spreadsheet'

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