Skip to main content
Glama
taylorwilsdon

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

list_spaces

Retrieve a formatted list of Google Chat spaces, including rooms and direct messages, accessible to a specific user for streamlined communication management within Google Workspace.

Instructions

Lists Google Chat spaces (rooms and direct messages) accessible to the user.

Returns:
    str: A formatted list of Google Chat spaces accessible to the user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_sizeNo
serviceYes
space_typeNoall
user_google_emailYes

Implementation Reference

  • Implementation of the 'list_spaces' tool handler function, which lists Google Chat spaces using the Chat API. Registered via @server.tool() decorator. Handles filtering by space type (room, dm, all), pagination, and formats the output as a string list.
    @server.tool()
    @require_google_service("chat", "chat_read")
    @handle_http_errors("list_spaces", service_type="chat")
    async def list_spaces(
        service,
        user_google_email: str,
        page_size: int = 100,
        space_type: str = "all"  # "all", "room", "dm"
    ) -> str:
        """
        Lists Google Chat spaces (rooms and direct messages) accessible to the user.
    
        Returns:
            str: A formatted list of Google Chat spaces accessible to the user.
        """
        logger.info(f"[list_spaces] Email={user_google_email}, Type={space_type}")
    
        # Build filter based on space_type
        filter_param = None
        if space_type == "room":
            filter_param = "spaceType = SPACE"
        elif space_type == "dm":
            filter_param = "spaceType = DIRECT_MESSAGE"
    
        request_params = {"pageSize": page_size}
        if filter_param:
            request_params["filter"] = filter_param
    
        response = await asyncio.to_thread(
            service.spaces().list(**request_params).execute
        )
    
        spaces = response.get('spaces', [])
        if not spaces:
            return f"No Chat spaces found for type '{space_type}'."
    
        output = [f"Found {len(spaces)} Chat spaces (type: {space_type}):"]
        for space in spaces:
            space_name = space.get('displayName', 'Unnamed Space')
            space_id = space.get('name', '')
            space_type_actual = space.get('spaceType', 'UNKNOWN')
            output.append(f"- {space_name} (ID: {space_id}, Type: {space_type_actual})")
    
        return "\n".join(output)
  • Registration of the 'list_spaces' tool using the @server.tool() decorator.
    @server.tool()
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the return type ('A formatted list') but lacks critical details such as pagination behavior (despite a 'page_size' parameter), authentication requirements, rate limits, or whether the operation is read-only or has side effects. This is a significant gap for a tool with parameters and no annotations.

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 appropriately concise with two sentences: one for the purpose and one for the return value. It is front-loaded with the main action, though the return statement could be integrated more smoothly. There is no wasted verbiage.

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 (4 parameters, 0% schema coverage, no annotations, no output schema), the description is incomplete. It lacks details on parameter usage, behavioral traits (e.g., pagination, auth), and output format beyond a vague 'formatted list'. For a tool with multiple inputs and no structured guidance, this is inadequate.

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

Parameters2/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 for undocumented parameters. It adds no information about the four parameters (e.g., 'page_size', 'service', 'space_type', 'user_google_email'), their meanings, or how they affect the listing. The description only repeats the tool's purpose without enhancing 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 tool's purpose: 'Lists Google Chat spaces (rooms and direct messages) accessible to the user.' It specifies the verb ('Lists'), resource ('Google Chat spaces'), and scope ('accessible to the user'), but does not distinguish it from potential sibling tools like 'list_calendars' or 'list_docs_in_folder' beyond the resource type.

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 does not mention any prerequisites, exclusions, or related tools (e.g., 'search_messages' for filtering), leaving the agent to infer usage solely from the purpose statement.

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