Skip to main content
Glama
adexltd

MCP Google Suite

by adexltd

sheets_update_values

Modify data in a specified range of a Google Sheet by providing new values in a structured format.

Instructions

Update values in a Google Sheet range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spreadsheet_idYesID of the spreadsheet
rangeYesA1 notation range
valuesYes2D array of values

Implementation Reference

  • MCP tool handler for sheets_update_values. Parses input arguments, validates them, logs the operation, calls SheetsService.update_values, and returns the result.
    async def _handle_sheets_update_values(
        self, context: GoogleWorkspaceContext, arguments: dict
    ) -> Dict[str, Any]:
        """Handle sheets update values requests."""
        spreadsheet_id = arguments.get("spreadsheet_id")
        range_name = arguments.get("range")
        values = arguments.get("values")
    
        if not spreadsheet_id or not range_name or values is None:
            raise ValueError("spreadsheet_id, range, and values are required")
    
        logger.debug(f"Updating sheet values - ID: {spreadsheet_id}, Range: {range_name}")
        result = await context.sheets.update_values(
            spreadsheet_id=spreadsheet_id, range_name=range_name, values=values
        )
        logger.debug(f"Sheet values updated - Updated cells: {result.get('updatedCells', 0)}")
        return result
  • Input schema for the sheets_update_values tool, defining the required parameters: spreadsheet_id, range, and values (2D array).
    types.Tool(
        name="sheets_update_values",
        description="Update values in a Google Sheet range",
        inputSchema={
            "type": "object",
            "properties": {
                "spreadsheet_id": {
                    "type": "string",
                    "description": "ID of the spreadsheet",
                },
                "range": {"type": "string", "description": "A1 notation range"},
                "values": {
                    "type": "array",
                    "items": {"type": "array", "items": {"type": "string"}},
                    "description": "2D array of values",
                },
            },
            "required": ["spreadsheet_id", "range", "values"],
        },
    ),
  • Core implementation in SheetsService that performs the actual Google Sheets API update_values call, handling errors and formatting the request body.
    def update_values(
        self,
        spreadsheet_id: str,
        range_name: str,
        values: List[List[Any]],
        major_dimension: str = "ROWS",
    ) -> Dict[str, Any]:
        """Update values in a specific range of a spreadsheet."""
        try:
            body = {"values": values, "majorDimension": major_dimension}
    
            result = (
                self.service.spreadsheets()
                .values()
                .update(
                    spreadsheetId=spreadsheet_id,
                    range=range_name,
                    valueInputOption="USER_ENTERED",
                    body=body,
                )
                .execute()
            )
    
            return {"success": True, "result": result}
        except HttpError as error:
            return {"success": False, **self.handle_error(error)}
Behavior2/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 states this is an update operation, implying mutation, but doesn't clarify if it overwrites existing values, merges them, or requires specific authentication. It also omits details like error handling, response format, or whether the operation is idempotent, leaving significant 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 a single, direct sentence with zero wasted words. It front-loads the core action ('Update values') and resource ('Google Sheet range'), making it easy to scan and understand quickly. Every word earns its place by conveying essential information without redundancy.

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

Completeness2/5

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

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., success confirmation, updated values), potential side effects (e.g., formatting changes), or error conditions. Given the complexity of updating spreadsheet data, more context is needed to guide the agent effectively.

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?

The input schema has 100% description coverage, clearly documenting all three parameters (spreadsheet_id, range, values). The description adds no additional semantic context beyond what the schema provides, such as examples of valid ranges or value formats. This meets the baseline for high schema coverage but doesn't enhance parameter understanding.

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

Purpose4/5

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

The description clearly states the action ('Update values') and resource ('in a Google Sheet range'), making the tool's purpose immediately understandable. It distinguishes itself from sibling tools like sheets_create or sheets_get_values by focusing on modification rather than creation or retrieval. However, it doesn't specify what type of values can be updated or the exact scope of 'range' beyond the schema.

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 sheets_create for new sheets or docs_update_content for Google Docs. It doesn't mention prerequisites (e.g., needing edit permissions), constraints (e.g., rate limits), or typical use cases. The agent must infer usage from the tool name and schema alone.

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/adexltd/mcp-google-suite'

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