Skip to main content
Glama
taylorwilsdon

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

send_message

Send messages directly to Google Chat spaces using the tool within the Google Workspace MCP Server. Specify user details, space ID, and message text for effective communication.

Instructions

Sends a message to a Google Chat space.

Returns:
    str: Confirmation message with sent message details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
message_textYes
serviceYes
space_idYes
thread_keyNo
user_google_emailYes

Implementation Reference

  • The core handler function `send_message` that sends a text message to a specified Google Chat space using the Google Chat API service. It supports optional thread_key for threaded replies and returns a confirmation with message ID and timestamp.
    async def send_message(
        service,
        user_google_email: str,
        space_id: str,
        message_text: str,
        thread_key: Optional[str] = None
    ) -> str:
        """
        Sends a message to a Google Chat space.
    
        Returns:
            str: Confirmation message with sent message details.
        """
        logger.info(f"[send_message] Email: '{user_google_email}', Space: '{space_id}'")
    
        message_body = {
            'text': message_text
        }
    
        # Add thread key if provided (for threaded replies)
        request_params = {
            'parent': space_id,
            'body': message_body
        }
        if thread_key:
            request_params['threadKey'] = thread_key
    
        message = await asyncio.to_thread(
            service.spaces().messages().create(**request_params).execute
        )
    
        message_name = message.get('name', '')
        create_time = message.get('createTime', '')
    
        msg = f"Message sent to space '{space_id}' by {user_google_email}. Message ID: {message_name}, Time: {create_time}"
        logger.info(f"Successfully sent message to space '{space_id}' by {user_google_email}")
        return msg
  • Registers the `send_message` tool in the MCP server registry using the `@server.tool()` decorator.
    @server.tool()
  • Input schema defined by function parameters: service (inferred), user_google_email: str, space_id: str, message_text: str, thread_key: Optional[str] = None. Output: str confirmation.
    async def send_message(
        service,
        user_google_email: str,
        space_id: str,
        message_text: str,
        thread_key: Optional[str] = None
    ) -> str:

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