Skip to main content
Glama
josedu90

MCP Google Workspace Server

sheets_get_values

Extract specific data from a Google Sheets range using the spreadsheet ID and A1 notation. Facilitates integration with Google Workspace via natural language commands.

Instructions

Get values from a Google Sheet range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rangeYesA1 notation range
spreadsheet_idYesID of the spreadsheet

Implementation Reference

  • The MCP tool handler for sheets_get_values. Validates input arguments and delegates to SheetsService.get_values to fetch values from the specified spreadsheet range.
    async def _handle_sheets_get_values(
        self, context: GoogleWorkspaceContext, arguments: dict
    ) -> Dict[str, Any]:
        """Handle sheets get values requests."""
        spreadsheet_id = arguments.get("spreadsheet_id")
        range_name = arguments.get("range")
    
        if not spreadsheet_id or not range_name:
            raise ValueError("Both spreadsheet_id and range are required")
    
        logger.debug(f"Getting sheet values - ID: {spreadsheet_id}, Range: {range_name}")
        result = await context.sheets.get_values(
            spreadsheet_id=spreadsheet_id, range_name=range_name
        )
        logger.debug(f"Sheet values retrieved - Row count: {len(result.get('values', []))}")
        return result
  • Input schema definition for the sheets_get_values tool, specifying required parameters: spreadsheet_id and range.
    types.Tool(
        name="sheets_get_values",
        description="Get values from a Google Sheet range",
        inputSchema={
            "type": "object",
            "properties": {
                "spreadsheet_id": {
                    "type": "string",
                    "description": "ID of the spreadsheet",
                },
                "range": {"type": "string", "description": "A1 notation range"},
            },
            "required": ["spreadsheet_id", "range"],
        },
    ),
  • Dynamic registration of tool handlers, including sheets_get_values, by looking up _handle_sheets_get_values and adding to registry.
    for tool in self._get_tools_list():
        handler_name = f"_handle_{tool.name}"
        if hasattr(self, handler_name):
            handler = getattr(self, handler_name)
            self._tool_registry[tool.name] = handler
            logger.debug(f"Registered handler for {tool.name}")
  • Core implementation in SheetsService that interacts with Google Sheets API to retrieve values from the specified range.
    def get_values(self, spreadsheet_id: str, range_name: str) -> Dict[str, Any]:
        """Get values from a specific range in a spreadsheet."""
        try:
            result = (
                self.service.spreadsheets()
                .values()
                .get(spreadsheetId=spreadsheet_id, range=range_name)
                .execute()
            )
    
            return {"success": True, "values": result.get("values", [])}
        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 the tool reads values, implying it's non-destructive, but doesn't cover critical aspects like authentication requirements, rate limits, error handling, or what the return format looks like (especially since there's no output schema). This leaves significant gaps for an agent to understand how to use it effectively.

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, efficient sentence with zero waste—it directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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?

Given the complexity of interacting with Google Sheets (which involves authentication, API constraints, and data formatting), the description is insufficient. With no annotations, no output schema, and minimal behavioral context, it doesn't provide enough information for an agent to use the tool confidently in real-world scenarios, despite the 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?

The schema description coverage is 100%, with both parameters (range and spreadsheet_id) clearly documented in the schema. The description adds no additional meaning beyond the schema, such as examples or context for how these parameters interact. This meets the baseline score of 3 since the schema does the heavy lifting.

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 ('Get values') and target resource ('from a Google Sheet range'), providing a specific verb+resource combination. However, it doesn't differentiate this tool from potential sibling read operations on sheets (though none exist in the provided sibling list), making it clear but not fully distinctive.

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. It doesn't mention prerequisites (e.g., authentication), compare it to other sheet-related tools like sheets_update_values, or specify scenarios where it's appropriate (e.g., for reading data vs. modifying it).

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/josedu90/mcp-suiteg'

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