Skip to main content
Glama
taylorwilsdon

Google Workspace MCP Server - Control Gmail, Calendar, Docs, Sheets, Slides, Chat, Forms & Drive

read_sheet_values

Extract formatted data from a specific range in a Google Sheet using the user's email, spreadsheet ID, and range name for precise data retrieval.

Instructions

Reads values from a specific range in a Google Sheet.

Args:
    user_google_email (str): The user's Google email address. Required.
    spreadsheet_id (str): The ID of the spreadsheet. Required.
    range_name (str): The range to read (e.g., "Sheet1!A1:D10", "A1:D10"). Defaults to "A1:Z1000".

Returns:
    str: The formatted values from the specified range.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
range_nameNoA1:Z1000
serviceYes
spreadsheet_idYes
user_google_emailYes

Implementation Reference

  • The core handler function for the 'read_sheet_values' tool. It reads values from a specified range in a Google Sheet using the Google Sheets API, formats them into a readable text output, and handles errors via decorators.
    @server.tool()
    @handle_http_errors("read_sheet_values", is_read_only=True, service_type="sheets")
    @require_google_service("sheets", "sheets_read")
    async def read_sheet_values(
        service,
        user_google_email: str,
        spreadsheet_id: str,
        range_name: str = "A1:Z1000",
    ) -> str:
        """
        Reads values from a specific range in a Google Sheet.
    
        Args:
            user_google_email (str): The user's Google email address. Required.
            spreadsheet_id (str): The ID of the spreadsheet. Required.
            range_name (str): The range to read (e.g., "Sheet1!A1:D10", "A1:D10"). Defaults to "A1:Z1000".
    
        Returns:
            str: The formatted values from the specified range.
        """
        logger.info(f"[read_sheet_values] Invoked. Email: '{user_google_email}', Spreadsheet: {spreadsheet_id}, Range: {range_name}")
    
        result = await asyncio.to_thread(
            service.spreadsheets()
            .values()
            .get(spreadsheetId=spreadsheet_id, range=range_name)
            .execute
        )
    
        values = result.get("values", [])
        if not values:
            return f"No data found in range '{range_name}' for {user_google_email}."
    
        # Format the output as a readable table
        formatted_rows = []
        for i, row in enumerate(values, 1):
            # Pad row with empty strings to show structure
            padded_row = row + [""] * max(0, len(values[0]) - len(row)) if values else row
            formatted_rows.append(f"Row {i:2d}: {padded_row}")
    
        text_output = (
            f"Successfully read {len(values)} rows from range '{range_name}' in spreadsheet {spreadsheet_id} for {user_google_email}:\n"
            + "\n".join(formatted_rows[:50])  # Limit to first 50 rows for readability
            + (f"\n... and {len(values) - 50} more rows" if len(values) > 50 else "")
        )
    
        logger.info(f"Successfully read {len(values)} rows for {user_google_email}.")
        return text_output
  • Imports the 'read_sheet_values' tool from sheets_tools.py and includes it in __all__, effectively registering or exposing it for use in the MCP server.
    from .sheets_tools import (
        list_spreadsheets,
        get_spreadsheet_info,
        read_sheet_values,
        modify_sheet_values,
        create_spreadsheet,
        create_sheet,
    )
    
    __all__ = [
        "list_spreadsheets",
        "get_spreadsheet_info", 
        "read_sheet_values",
        "modify_sheet_values",
        "create_spreadsheet",
        "create_sheet",
    ]
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool reads values and returns formatted values as a string, which covers basic behavior. However, it lacks critical details: authentication requirements (though 'user_google_email' hints at it), rate limits, error handling, whether it's read-only (implied but not explicit), or how values are formatted (e.g., CSV, JSON). For a tool with no annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, Args, Returns) and front-loaded key information. Every sentence adds value: the first states the purpose, and subsequent lines explain parameters and return value. It could be slightly more concise by integrating the default range into the purpose statement, but overall it's efficient with minimal waste.

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

Completeness3/5

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

Given no annotations, 0% schema coverage, and no output schema, the description does a decent job covering basics: purpose, parameters, and return type. However, it lacks details on authentication, error cases, formatting specifics, or behavioral constraints. For a tool interacting with external APIs (Google Sheets), this leaves gaps that could hinder effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides clear semantics for all 4 parameters: 'user_google_email' (user's Google email), 'spreadsheet_id' (ID of spreadsheet), 'range_name' (range to read with examples and default), and implicitly covers 'service' through context. However, it doesn't explain the 'service' parameter's purpose or possible values, leaving one parameter partially undocumented.

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 tool's purpose with a specific verb ('Reads') and resource ('values from a specific range in a Google Sheet'). It distinguishes itself from sibling tools like 'get_spreadsheet_info' (metadata) and 'modify_sheet_values' (write operation) by focusing on reading cell values from a defined range.

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 context through parameter explanations (e.g., 'range_name' defaults to 'A1:Z1000'), but it doesn't explicitly state when to use this tool versus alternatives like 'get_spreadsheet_info' for metadata or 'search_drive_files' for finding spreadsheets. No explicit when-not-to-use guidance or prerequisite information is provided.

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

Related 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/taylorwilsdon/google_workspace_mcp'

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