delete_task
Remove a specific task from a Google Tasks list by providing the user's email, task list ID, and task ID. Confirms deletion upon completion.
Instructions
Delete a task from a task list.
Args: user_google_email (str): The user's Google email address. Required. task_list_id (str): The ID of the task list containing the task. task_id (str): The ID of the task to delete.
Returns: str: Confirmation message.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | ||
| task_list_id | Yes | ||
| user_google_email | Yes |
Implementation Reference
- gtasks/tasks_tools.py:737-777 (handler)The main handler function for the 'delete_task' MCP tool. It deletes the specified task from the Google Tasks API using the provided service, task list ID, and task ID. Includes authentication decorators, error handling, logging, and a confirmation response.@server.tool() # type: ignore @require_google_service("tasks", "tasks") # type: ignore @handle_http_errors("delete_task", service_type="tasks") # type: ignore async def delete_task( service: Resource, user_google_email: str, task_list_id: str, task_id: str ) -> str: """ Delete a task from a task list. Args: user_google_email (str): The user's Google email address. Required. task_list_id (str): The ID of the task list containing the task. task_id (str): The ID of the task to delete. Returns: str: Confirmation message. """ logger.info(f"[delete_task] Invoked. Email: '{user_google_email}', Task List ID: {task_list_id}, Task ID: {task_id}") try: await asyncio.to_thread( service.tasks().delete(tasklist=task_list_id, task=task_id).execute ) response = f"Task {task_id} has been deleted from task list {task_list_id} for {user_google_email}." logger.info(f"Deleted task {task_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)