Skip to main content
Glama

google_tasks_create_task

Create and manage tasks within Google Tasks by specifying a title, notes, due date, and task list. Integrates with Google MCP for AI-driven task management workflows.

Instructions

Create a new task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dueNoDue date in RFC 3339 format (e.g., '2025-04-02T10:00:00.000Z')
notesNoNotes or description for the task
taskListIdNoID of the task list to create the task in (uses default if not specified)
titleYesTitle of the task

Implementation Reference

  • Handler function that validates input arguments and delegates to GoogleTasks.createTask to create a new task.
    export async function handleTasksCreateTask( args: any, googleTasksInstance: GoogleTasks ) { if (!isCreateTaskArgs(args)) { throw new Error("Invalid arguments for google_tasks_create_task"); } const { title, notes, due, taskListId } = args; const result = await googleTasksInstance.createTask( title, notes, due, taskListId ); return { content: [{ type: "text", text: result }], isError: false, }; }
  • Implements the task creation using Google Tasks API v1, inserting a new task into the specified tasklist.
    async createTask( title: string, notes?: string, due?: string, taskListId?: string ) { try { const targetTaskList = taskListId || this.defaultTaskList; // Prepare task data const taskData: any = { title: title, }; if (notes) taskData.notes = notes; if (due) taskData.due = due; const response = await this.tasks.tasks.insert({ tasklist: targetTaskList, requestBody: taskData, }); return `Task created: "${response.data.title}" with ID: ${response.data.id}`; } catch (error) { throw new Error( `Failed to create task: ${ error instanceof Error ? error.message : String(error) }` ); } }
  • MCP Tool definition including name, description, and input schema for creating a task.
    export const CREATE_TASK_TOOL: Tool = { name: "google_tasks_create_task", description: "Create a new task", inputSchema: { type: "object", properties: { title: { type: "string", description: "Title of the task", }, notes: { type: "string", description: "Notes or description for the task", }, due: { type: "string", description: "Due date in RFC 3339 format (e.g., '2025-04-02T10:00:00.000Z')", }, taskListId: { type: "string", description: "ID of the task list to create the task in (uses default if not specified)", }, }, required: ["title"], }, };
  • Dispatches tool calls named 'google_tasks_create_task' to the corresponding handler function.
    case "google_tasks_create_task": return await tasksHandlers.handleTasksCreateTask( args, googleTasksInstance );
  • Type guard function used in the handler to validate input arguments against the expected schema.
    export function isCreateTaskArgs(args: any): args is { title: string; notes?: string; due?: string; taskListId?: string; } { return ( args && typeof args.title === "string" && (args.notes === undefined || typeof args.notes === "string") && (args.due === undefined || typeof args.due === "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