Skip to main content
Glama
ZatesloFL

Google Workspace MCP Server

by ZatesloFL

clear_completed_tasks

Remove completed tasks from a Google Workspace task list. This tool marks completed tasks as hidden, helping users maintain a clean and organized task list.

Instructions

Clear all completed tasks from a task list. The tasks will be marked as hidden.

Args: user_google_email (str): The user's Google email address. Required. task_list_id (str): The ID of the task list to clear completed tasks from.

Returns: str: Confirmation message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_list_idYes
user_google_emailYes

Implementation Reference

  • The handler function for the 'clear_completed_tasks' tool. It is registered via @server.tool(), requires Google Tasks authentication, handles errors, logs the action, calls the Google Tasks API to clear (hide) all completed tasks in the specified task list, and returns a confirmation message.
    @server.tool()  # type: ignore
    @require_google_service("tasks", "tasks")  # type: ignore
    @handle_http_errors("clear_completed_tasks", service_type="tasks")  # type: ignore
    async def clear_completed_tasks(
        service: Resource,
        user_google_email: str,
        task_list_id: str
    ) -> str:
        """
        Clear all completed tasks from a task list. The tasks will be marked as hidden.
    
        Args:
            user_google_email (str): The user's Google email address. Required.
            task_list_id (str): The ID of the task list to clear completed tasks from.
    
        Returns:
            str: Confirmation message.
        """
        logger.info(f"[clear_completed_tasks] Invoked. Email: '{user_google_email}', Task List ID: {task_list_id}")
    
        try:
            await asyncio.to_thread(
                service.tasks().clear(tasklist=task_list_id).execute
            )
    
            response = f"All completed tasks have been cleared from task list {task_list_id} for {user_google_email}. The tasks are now hidden and won't appear in default task list views."
    
            logger.info(f"Cleared completed tasks from list {task_list_id} for {user_google_email}")
            return response
    
        except HttpError as error:
            message = f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
            logger.error(message, exc_info=True)
            raise Exception(message)
        except Exception as e:
            message = f"Unexpected error: {e}."
            logger.exception(message)
            raise Exception(message)
  • The @server.tool() decorator registers the clear_completed_tasks function as an MCP tool.
    @server.tool()  # type: ignore
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