create_task_list
Create and manage task lists in Google Workspace. Specify a user’s Google email and task list title to generate a new task list efficiently.
Instructions
Create a new task list.
Args: user_google_email (str): The user's Google email address. Required. title (str): The title of the new task list.
Returns: str: Confirmation message with the new task list ID and details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | ||
| user_google_email | Yes |
Implementation Reference
- gtasks/tasks_tools.py:148-194 (handler)The main handler function for the 'create_task_list' tool. It creates a new task list in Google Tasks API using the provided title, handles authentication via decorator, error handling, and returns formatted response with new list details. Registered via @server.tool() decorator.@server.tool() # type: ignore @require_google_service("tasks", "tasks") # type: ignore @handle_http_errors("create_task_list", service_type="tasks") # type: ignore async def create_task_list( service: Resource, user_google_email: str, title: str ) -> str: """ Create a new task list. Args: user_google_email (str): The user's Google email address. Required. title (str): The title of the new task list. Returns: str: Confirmation message with the new task list ID and details. """ logger.info(f"[create_task_list] Invoked. Email: '{user_google_email}', Title: '{title}'") try: body = { "title": title } result = await asyncio.to_thread( service.tasklists().insert(body=body).execute ) response = f"""Task List Created for {user_google_email}: - Title: {result['title']} - ID: {result['id']} - Created: {result.get('updated', 'N/A')} - Self Link: {result.get('selfLink', 'N/A')}""" logger.info(f"Created task list '{title}' with ID {result['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)