Skip to main content
Glama
marekrost

mcp-server-spreadsheet

get_sheet_dimensions

Retrieve the row and column count of data in a spreadsheet sheet to determine its size and structure for processing or analysis.

Instructions

Get the dimensions of the used range in a sheet.

Returns {"rows": N, "columns": M} where N is the number of the last used row and M is the number of the last used column. Both are 0 for an empty sheet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the spreadsheet file
sheetNoSheet name. Defaults to the first sheet if omitted.

Implementation Reference

  • Implementation of the 'get_sheet_dimensions' tool, which uses 'load_workbook' and '_resolve_sheet' helpers to retrieve dimensions from the SpreadsheetSheet object.
    def get_sheet_dimensions(
        file: Annotated[str, Field(description="Path to the spreadsheet file")],
        sheet: Annotated[str | None, Field(description="Sheet name. Defaults to the first sheet if omitted.")] = None,
    ) -> dict:
        """Get the dimensions of the used range in a sheet.
    
        Returns {"rows": N, "columns": M} where N is the number of the last
        used row and M is the number of the last used column. Both are 0 for
        an empty sheet.
        """
        wb = load_workbook(file)
        ws = _resolve_sheet(wb, sheet)
        return {
            "rows": ws.max_row,
            "columns": ws.max_column,
        }
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 of behavioral disclosure. It effectively describes the return format (JSON with rows and columns), defines the meaning of dimensions (last used row/column), and specifies edge-case behavior (0 for empty sheet). However, it lacks details on error conditions, performance, or authentication needs.

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 return details and edge-case behavior in a compact format. Every sentence adds critical value without redundancy, making it highly efficient and well-structured.

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

Completeness4/5

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

For a read-only tool with no annotations and no output schema, the description provides strong completeness by detailing the return format and edge cases. It could improve by mentioning error handling or performance, but it adequately covers the tool's core functionality given its simplicity and clear schema.

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 (file and sheet). The description does not add any parameter-specific semantics beyond what the schema provides, such as file format expectations or sheet naming conventions, meeting the baseline for high schema coverage.

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 ('Get the dimensions of the used range') and resource ('in a sheet'), distinguishing it from siblings like read_range or describe_table. It precisely defines what constitutes 'dimensions' (rows and columns of the used range) and includes edge-case behavior for empty sheets.

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?

The description implies usage for retrieving sheet dimensions but does not explicitly state when to use this tool versus alternatives like list_sheets (for sheet names) or read_range (for content). No guidance on prerequisites or exclusions is provided, leaving usage context inferred rather than stated.

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