Skip to main content
Glama

google_tasks_delete_task

Removes a specific task from a Google Tasks list by providing its task ID. Optionally, specify the task list ID for targeted deletion within Google MCP server.

Instructions

Delete a task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesID of the task to delete
taskListIdNoID of the task list the task belongs to (uses default if not specified)

Implementation Reference

  • The main handler function that validates the input arguments and invokes the GoogleTasks instance to delete the specified task.
    export async function handleTasksDeleteTask( args: any, googleTasksInstance: GoogleTasks ) { if (!isDeleteTaskArgs(args)) { throw new Error("Invalid arguments for google_tasks_delete_task"); } const { taskId, taskListId } = args; const result = await googleTasksInstance.deleteTask(taskId, taskListId); return { content: [{ type: "text", text: result }], isError: false, }; }
  • The tool's schema definition, including input schema for parameters taskId (required) and optional taskListId.
    export const DELETE_TASK_TOOL: Tool = { name: "google_tasks_delete_task", description: "Delete a task", inputSchema: { type: "object", properties: { taskId: { type: "string", description: "ID of the task to delete", }, taskListId: { type: "string", description: "ID of the task list the task belongs to (uses default if not specified)", }, }, required: ["taskId"], }, };
  • Registration in the server request handler's switch statement that dispatches calls to this tool to the appropriate handler function.
    case "google_tasks_delete_task": return await tasksHandlers.handleTasksDeleteTask( args, googleTasksInstance );
  • Core helper method in the GoogleTasks class that calls the Google Tasks API to delete the task.
    async deleteTask(taskId: string, taskListId?: string) { try { const targetTaskList = taskListId || this.defaultTaskList; await this.tasks.tasks.delete({ tasklist: targetTaskList, task: taskId, }); return `Task ${taskId} deleted from task list ${targetTaskList}.`; } catch (error) { throw new Error( `Failed to delete task: ${ error instanceof Error ? error.message : String(error) }` ); } }
  • Type guard (schema validator) used in the handler to validate input arguments match the expected types.
    export function isDeleteTaskArgs(args: any): args is { taskId: string; taskListId?: string; } { return ( args && typeof args.taskId === "string" && (args.taskListId === undefined || 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