Skip to main content
Glama

google_tasks_delete_tasklist

Automate the deletion of task lists in Google Tasks using the task list ID to streamline task management and maintain organization.

Instructions

Delete a task list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskListIdYesID of the task list to delete

Implementation Reference

  • The main handler function that validates input arguments using isDeleteTaskListArgs and delegates to the GoogleTasks instance's deleteTaskList method to perform the deletion.
    export async function handleTasksDeleteTasklist(
      args: any,
      googleTasksInstance: GoogleTasks
    ) {
      if (!isDeleteTaskListArgs(args)) {
        throw new Error("Invalid arguments for google_tasks_delete_tasklist");
      }
      const { taskListId } = args;
      const result = await googleTasksInstance.deleteTaskList(taskListId);
      return {
        content: [{ type: "text", text: result }],
        isError: false,
      };
    }
  • The core implementation in the GoogleTasks class that calls the Google Tasks API to delete the specified task list.
    async deleteTaskList(taskListId: string) {
      try {
        await this.tasks.tasklists.delete({
          tasklist: taskListId,
        });
    
        return `Task list ${taskListId} deleted.`;
      } catch (error) {
        throw new Error(
          `Failed to delete task list: ${
            error instanceof Error ? error.message : String(error)
          }`
        );
      }
    }
  • The tool definition including name, description, and input schema for validation.
    export const DELETE_TASKLIST_TOOL: Tool = {
      name: "google_tasks_delete_tasklist",
      description: "Delete a task list",
      inputSchema: {
        type: "object",
        properties: {
          taskListId: {
            type: "string",
            description: "ID of the task list to delete",
          },
        },
        required: ["taskListId"],
      },
    };
  • The switch case in the main server request handler that routes calls to this tool to its handler function.
    case "google_tasks_delete_tasklist":
      return await tasksHandlers.handleTasksDeleteTasklist(
        args,
        googleTasksInstance
      );
  • Type guard function used in the handler to validate input arguments matching the tool schema.
    export function isDeleteTaskListArgs(args: any): args is {
      taskListId: string;
    } {
      return args && typeof args.taskListId === "string";
    }

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/vakharwalad23/google-mcp'

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