Skip to main content
Glama
ZatesloFL

Google Workspace MCP Server

by ZatesloFL

batch_update_presentation

Apply multiple updates to a Google Slides presentation in a single batch operation. Specify the user email, presentation ID, and list of update requests to modify slides efficiently.

Instructions

Apply batch updates to a Google Slides presentation.

Args: user_google_email (str): The user's Google email address. Required. presentation_id (str): The ID of the presentation to update. requests (List[Dict[str, Any]]): List of update requests to apply.

Returns: str: Details about the batch update operation results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
presentation_idYes
requestsYes
user_google_emailYes

Implementation Reference

  • The primary handler function for the 'batch_update_presentation' tool. It registers the tool via @server.tool(), handles authentication and errors, and executes batch updates on a Google Slides presentation using the API's batchUpdate method. Processes requests, executes the API call off-thread, parses replies, and returns a formatted confirmation message with results.
    @server.tool()
    @handle_http_errors("batch_update_presentation", service_type="slides")
    @require_google_service("slides", "slides")
    async def batch_update_presentation(
        service,
        user_google_email: str,
        presentation_id: str,
        requests: List[Dict[str, Any]]
    ) -> str:
        """
        Apply batch updates to a Google Slides presentation.
    
        Args:
            user_google_email (str): The user's Google email address. Required.
            presentation_id (str): The ID of the presentation to update.
            requests (List[Dict[str, Any]]): List of update requests to apply.
    
        Returns:
            str: Details about the batch update operation results.
        """
        logger.info(f"[batch_update_presentation] Invoked. Email: '{user_google_email}', ID: '{presentation_id}', Requests: {len(requests)}")
    
        body = {
            'requests': requests
        }
    
        result = await asyncio.to_thread(
            service.presentations().batchUpdate(
                presentationId=presentation_id,
                body=body
            ).execute
        )
    
        replies = result.get('replies', [])
    
        confirmation_message = f"""Batch Update Completed for {user_google_email}:
    - Presentation ID: {presentation_id}
    - URL: https://docs.google.com/presentation/d/{presentation_id}/edit
    - Requests Applied: {len(requests)}
    - Replies Received: {len(replies)}"""
    
        if replies:
            confirmation_message += "\n\nUpdate Results:"
            for i, reply in enumerate(replies, 1):
                if 'createSlide' in reply:
                    slide_id = reply['createSlide'].get('objectId', 'Unknown')
                    confirmation_message += f"\n  Request {i}: Created slide with ID {slide_id}"
                elif 'createShape' in reply:
                    shape_id = reply['createShape'].get('objectId', 'Unknown')
                    confirmation_message += f"\n  Request {i}: Created shape with ID {shape_id}"
                else:
                    confirmation_message += f"\n  Request {i}: Operation completed"
    
        logger.info(f"Batch update completed successfully for {user_google_email}")
        return confirmation_message
Install Server

Other 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/ZatesloFL/google_workspace_mcp'

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