Skip to main content
Glama
marekrost

mcp-server-spreadsheet

clear_range

Clear cell values in a spreadsheet range while preserving row and column structure. Use this tool to remove data from specific cells without deleting rows or columns.

Instructions

Clear all cell values in a range without removing rows or columns.

Sets every cell in the range to null. Row/column structure is preserved.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the spreadsheet file
range_strYesRange to clear in A1 notation, e.g. 'A1:D10'. Only values are removed.
sheetNoSheet name. Defaults to the first sheet if omitted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The clear_range tool handler, which clears cell values in a specified range and saves the spreadsheet.
    @mcp.tool()
    def clear_range(
        file: Annotated[str, Field(description="Path to the spreadsheet file")],
        range_str: Annotated[str, Field(description="Range to clear in A1 notation, e.g. 'A1:D10'. Only values are removed.")],
        sheet: Annotated[str | None, Field(description="Sheet name. Defaults to the first sheet if omitted.")] = None,
    ) -> str:
        """Clear all cell values in a range without removing rows or columns.
    
        Sets every cell in the range to null. Row/column structure is preserved.
        """
        wb = load_workbook(file)
        ws = _resolve_sheet(wb, sheet)
        min_col, min_row, max_col, max_row = parse_range(range_str)
        for r in range(min_row, max_row + 1):
            for c in range(min_col, max_col + 1):
                ws.set_cell(r, c, None)
        wb.save(file)
        return f"Cleared range {range_str}"
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 clearly states the tool's effect ('sets every cell in the range to null') and what it preserves ('row/column structure is preserved'), which is good. However, it doesn't mention potential side effects, permissions needed, error conditions, or what happens to formulas/formatting in the cleared range.

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 perfectly concise with just two sentences that each earn their place. The first sentence states the core purpose, and the second clarifies the behavioral effect. There's zero wasted text, and the information is front-loaded appropriately.

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 that there's an output schema (though not shown), the description doesn't need to explain return values. For a mutation tool with no annotations, the description does a good job explaining what the tool does and what it preserves. However, it could be more complete by mentioning what happens to cell formatting or formulas in the cleared range.

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 doesn't add any parameter-specific information beyond what's in the schema. The baseline score of 3 is appropriate when the schema does the heavy lifting for parameter documentation.

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 ('clear all cell values in a range') and resource ('spreadsheet'), distinguishing it from siblings like delete_rows/columns (which remove structure) or write_range (which sets values). It explicitly notes that row/column structure is preserved, which differentiates it from destructive operations.

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 for when to use this tool ('clear all cell values in a range without removing rows or columns'), implying it should be used when you want to empty cells while keeping the spreadsheet structure intact. However, it doesn't explicitly mention when NOT to use it or name specific alternatives among the many sibling tools.

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