Skip to main content
Glama
taylorwilsdon

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

list_spreadsheets

Retrieve and display a list of Google Drive spreadsheets accessible to a specified user, including file names, IDs, and modification times. Configure results limit for precise output.

Instructions

Lists spreadsheets from Google Drive that the user has access to.

Args:
    user_google_email (str): The user's Google email address. Required.
    max_results (int): Maximum number of spreadsheets to return. Defaults to 25.

Returns:
    str: A formatted list of spreadsheet files (name, ID, modified time).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_resultsNo
serviceYes
user_google_emailYes

Implementation Reference

  • The handler function for the 'list_spreadsheets' tool. It lists the user's spreadsheets from Google Drive using the Drive API, formats them with name, ID, modified time, and link, and returns a formatted string.
    @server.tool()
    @handle_http_errors("list_spreadsheets", is_read_only=True, service_type="sheets")
    @require_google_service("drive", "drive_read")
    async def list_spreadsheets(
        service,
        user_google_email: str,
        max_results: int = 25,
    ) -> str:
        """
        Lists spreadsheets from Google Drive that the user has access to.
    
        Args:
            user_google_email (str): The user's Google email address. Required.
            max_results (int): Maximum number of spreadsheets to return. Defaults to 25.
    
        Returns:
            str: A formatted list of spreadsheet files (name, ID, modified time).
        """
        logger.info(f"[list_spreadsheets] Invoked. Email: '{user_google_email}'")
    
        files_response = await asyncio.to_thread(
            service.files()
            .list(
                q="mimeType='application/vnd.google-apps.spreadsheet'",
                pageSize=max_results,
                fields="files(id,name,modifiedTime,webViewLink)",
                orderBy="modifiedTime desc",
                supportsAllDrives=True,
                includeItemsFromAllDrives=True,
            )
            .execute
        )
    
        files = files_response.get("files", [])
        if not files:
            return f"No spreadsheets found for {user_google_email}."
    
        spreadsheets_list = [
            f"- \"{file['name']}\" (ID: {file['id']}) | Modified: {file.get('modifiedTime', 'Unknown')} | Link: {file.get('webViewLink', 'No link')}"
            for file in files
        ]
    
        text_output = (
            f"Successfully listed {len(files)} spreadsheets for {user_google_email}:\n"
            + "\n".join(spreadsheets_list)
        )
    
        logger.info(f"Successfully listed {len(files)} spreadsheets for {user_google_email}.")
        return text_output
  • The import and __all__ registration of the list_spreadsheets tool in the gs sheets module, making it available when the package is imported.
    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?

With no annotations provided, the description carries full burden but lacks critical behavioral details. It mentions the tool lists accessible spreadsheets but doesn't disclose authentication requirements, rate limits, pagination behavior, error conditions, or whether it's read-only. The return format is mentioned but without details on structure or limitations.

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?

Well-structured with clear sections (purpose, args, returns). The first sentence states the core functionality upfront. The parameter documentation is organized but includes the undocumented 'service' parameter in the schema.

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 3-parameter tool with no annotations and no output schema, the description is incomplete. It documents return format superficially but lacks details on authentication, error handling, pagination, and leaves one parameter unexplained. Given the complexity and lack of structured metadata, more behavioral context is needed.

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 0%, so the description must compensate. It documents two parameters (user_google_email and max_results) with basic semantics, but omits the third parameter 'service' entirely. The description adds value by explaining required status and defaults, but leaves one parameter undocumented.

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 verb ('Lists') and resource ('spreadsheets from Google Drive'), specifying scope ('that the user has access to'). It distinguishes from siblings like 'search_drive_files' by focusing specifically on spreadsheets, though it doesn't explicitly contrast with similar listing tools.

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?

No guidance on when to use this tool versus alternatives like 'search_drive_files' or 'list_docs_in_folder'. The description implies it's for listing accessible spreadsheets but doesn't specify prerequisites, exclusions, or comparison to 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

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