Skip to main content
Glama
arpitbatra123

Google Tasks MCP Server

create-task

Add a new task to Google Tasks with title, notes, and due date through Claude's interface.

Instructions

Create a new task in a task list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tasklistYesTask list ID
titleYesTitle of the task
notesNoNotes for the task
dueNoDue date in RFC 3339 format (e.g., 2025-03-19T12:00:00Z)

Implementation Reference

  • The asynchronous handler function that implements the 'create-task' tool logic. It checks authentication, constructs the task request body, inserts the task via the Google Tasks API, and handles success/error responses.
    async ({ tasklist, title, notes, due }) => {
      if (!isAuthenticated()) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: "Not authenticated. Please use the 'authenticate' tool first.",
            },
          ],
        };
      }
    
      try {
        const requestBody: any = {
          title,
          status: "needsAction",
        };
    
        if (notes) requestBody.notes = notes;
        if (due) requestBody.due = due;
    
        const response = await tasks.tasks.insert({
          tasklist,
          requestBody,
        });
    
        return {
          content: [
            {
              type: "text",
              text: `Task created successfully:\n\n${JSON.stringify(
                response.data,
                null,
                2
              )}`,
            },
          ],
        };
      } catch (error) {
        console.error("Error creating task:", error);
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Error creating task: ${error}`,
            },
          ],
        };
      }
    }
  • Zod schema defining the input parameters for the 'create-task' tool: tasklist (required string), title (required string), notes (optional string), due (optional string in RFC 3339 format).
    {
      tasklist: z.string().describe("Task list ID"),
      title: z.string().describe("Title of the task"),
      notes: z.string().optional().describe("Notes for the task"),
      due: z
        .string()
        .optional()
        .describe("Due date in RFC 3339 format (e.g., 2025-03-19T12:00:00Z)"),
    },
  • src/index.ts:592-656 (registration)
    The server.tool() call that registers the 'create-task' tool with its name, description, input schema, and handler function.
    server.tool(
      "create-task",
      "Create a new task in a task list",
      {
        tasklist: z.string().describe("Task list ID"),
        title: z.string().describe("Title of the task"),
        notes: z.string().optional().describe("Notes for the task"),
        due: z
          .string()
          .optional()
          .describe("Due date in RFC 3339 format (e.g., 2025-03-19T12:00:00Z)"),
      },
      async ({ tasklist, title, notes, due }) => {
        if (!isAuthenticated()) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: "Not authenticated. Please use the 'authenticate' tool first.",
              },
            ],
          };
        }
    
        try {
          const requestBody: any = {
            title,
            status: "needsAction",
          };
    
          if (notes) requestBody.notes = notes;
          if (due) requestBody.due = due;
    
          const response = await tasks.tasks.insert({
            tasklist,
            requestBody,
          });
    
          return {
            content: [
              {
                type: "text",
                text: `Task created successfully:\n\n${JSON.stringify(
                  response.data,
                  null,
                  2
                )}`,
              },
            ],
          };
        } catch (error) {
          console.error("Error creating task:", error);
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Error creating task: ${error}`,
              },
            ],
          };
        }
      }
    );

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/arpitbatra123/mcp-googletasks'

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