Skip to main content
Glama
marekrost

mcp-server-spreadsheet

insert_rows

Add new rows to a spreadsheet at a specified position, shifting existing rows downward. Optionally populate inserted rows with data values or leave them blank for manual entry.

Instructions

Insert rows at a given position, shifting existing rows down.

If data is provided, the inserted rows are filled with those values (type-coerced). Otherwise the rows are left blank.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the spreadsheet file
rowYes1-based row index where new rows will be inserted. Existing rows at and below this index shift down.
countNoNumber of rows to insert. If data is provided and longer, enough rows are inserted to fit the data.
dataNoOptional 2D array of values to fill the inserted rows. Leave empty for blank rows.
sheetNoSheet name. Defaults to the first sheet if omitted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `insert_rows` tool implementation which delegates to the backend workbook's `insert_rows` method and optionally fills the inserted rows with data.
    def insert_rows(
        file: Annotated[str, Field(description="Path to the spreadsheet file")],
        row: Annotated[int, Field(description="1-based row index where new rows will be inserted. Existing rows at and below this index shift down.")],
        count: Annotated[int, Field(description="Number of rows to insert. If data is provided and longer, enough rows are inserted to fit the data.")] = 1,
        data: Annotated[list[list] | None, Field(description="Optional 2D array of values to fill the inserted rows. Leave empty for blank rows.")] = None,
        sheet: Annotated[str | None, Field(description="Sheet name. Defaults to the first sheet if omitted.")] = None,
    ) -> str:
        """Insert rows at a given position, shifting existing rows down.
    
        If data is provided, the inserted rows are filled with those values
        (type-coerced). Otherwise the rows are left blank.
        """
        wb = load_workbook(file)
        ws = _resolve_sheet(wb, sheet)
        actual_count = max(count, len(data) if data else 0)
        ws.insert_rows(row, actual_count)
        if data:
            for r_idx, row_data in enumerate(data):
                for c_idx, val in enumerate(row_data):
                    ws.set_cell(row + r_idx, c_idx + 1, coerce_value(val))
        wb.save(file)
        return f"Inserted {actual_count} rows at row {row}"
Behavior3/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 explains the shifting behavior and data handling (type coercion, blank rows if no data), which are useful. However, it omits critical details like permission requirements, error conditions (e.g., invalid row index), or side effects on formulas/formatting, leaving gaps for a mutation tool.

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 a concise explanation of data handling. Every sentence earns its place with no wasted words, making it highly efficient and well-structured for quick comprehension.

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?

Given the tool's complexity (mutation with 5 parameters), no annotations, but a rich input schema (100% coverage) and an output schema (implied by 'Has output schema: true'), the description is reasonably complete. It covers key behaviors but could improve by addressing error cases or permissions, though the output schema reduces the need to explain return values.

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 mentioning 'data' and 'count' interactions, but doesn't provide additional semantics beyond what the schema describes (e.g., format examples for 'data'). Baseline 3 is appropriate as the schema does the heavy lifting.

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 ('Insert rows at a given position') and resource (spreadsheet rows), with explicit mention of 'shifting existing rows down' to distinguish it from sibling tools like 'append_rows' or 'write_range'. It precisely defines the tool's function without being tautological.

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 like 'append_rows' (for adding at the end) or 'write_range' (for overwriting). It mentions the tool's behavior but lacks explicit usage context or exclusions, leaving the agent to infer when this insertion method is appropriate.

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