Skip to main content
Glama
arpitbatra123

Google Tasks MCP Server

create-tasklist

Create a new task list in Google Tasks to organize and manage your to-do items through Claude's interface.

Instructions

Create a new task list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesTitle of the new task list

Implementation Reference

  • The handler function for the 'create-tasklist' tool. It checks if the user is authenticated, then uses the Google Tasks API to insert a new tasklist with the given title, and returns a success message with the response data or an error message.
    async ({ title }) => {
      if (!isAuthenticated()) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: "Not authenticated. Please use the 'authenticate' tool first.",
            },
          ],
        };
      }
    
      try {
        const response = await tasks.tasklists.insert({
          requestBody: {
            title,
          },
        });
    
        return {
          content: [
            {
              type: "text",
              text: `Task list created successfully:\n\n${JSON.stringify(
                response.data,
                null,
                2
              )}`,
            },
          ],
        };
      } catch (error) {
        console.error("Error creating task list:", error);
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Error creating task list: ${error}`,
            },
          ],
        };
      }
    }
  • Input schema for the 'create-tasklist' tool, defining a required 'title' parameter as a string.
    {
      title: z.string().describe("Title of the new task list"),
    },
  • src/index.ts:293-344 (registration)
    Registration of the 'create-tasklist' tool using server.tool(), specifying name, description, input schema, and inline handler function.
    server.tool(
      "create-tasklist",
      "Create a new task list",
      {
        title: z.string().describe("Title of the new task list"),
      },
      async ({ title }) => {
        if (!isAuthenticated()) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: "Not authenticated. Please use the 'authenticate' tool first.",
              },
            ],
          };
        }
    
        try {
          const response = await tasks.tasklists.insert({
            requestBody: {
              title,
            },
          });
    
          return {
            content: [
              {
                type: "text",
                text: `Task list created successfully:\n\n${JSON.stringify(
                  response.data,
                  null,
                  2
                )}`,
              },
            ],
          };
        } catch (error) {
          console.error("Error creating task list:", error);
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Error creating task list: ${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