Skip to main content
Glama
arpitbatra123

Google Tasks MCP Server

clear-completed-tasks

Remove all completed tasks from a Google Tasks list to maintain organization and focus on pending items.

Instructions

Clear all completed tasks from a task list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tasklistYesTask list ID

Implementation Reference

  • Handler function that implements the clear-completed-tasks tool logic: authenticates, clears completed tasks via Google Tasks API, handles errors.
    async ({ tasklist }) => {
      if (!isAuthenticated()) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: "Not authenticated. Please use the 'authenticate' tool first.",
            },
          ],
        };
      }
    
      try {
        await tasks.tasks.clear({
          tasklist,
        });
    
        return {
          content: [
            {
              type: "text",
              text: `All completed tasks in list '${tasklist}' have been cleared.`,
            },
          ],
        };
      } catch (error) {
        console.error("Error clearing completed tasks:", error);
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Error clearing completed tasks: ${error}`,
            },
          ],
        };
      }
    }
  • Zod input schema defining the 'tasklist' parameter as a string.
    {
      tasklist: z.string().describe("Task list ID"),
    },
  • src/index.ts:922-967 (registration)
    Registration of the 'clear-completed-tasks' tool on the MCP server with name, description, schema, and handler.
    server.tool(
      "clear-completed-tasks",
      "Clear all completed tasks from a task list",
      {
        tasklist: z.string().describe("Task list ID"),
      },
      async ({ tasklist }) => {
        if (!isAuthenticated()) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: "Not authenticated. Please use the 'authenticate' tool first.",
              },
            ],
          };
        }
    
        try {
          await tasks.tasks.clear({
            tasklist,
          });
    
          return {
            content: [
              {
                type: "text",
                text: `All completed tasks in list '${tasklist}' have been cleared.`,
              },
            ],
          };
        } catch (error) {
          console.error("Error clearing completed tasks:", error);
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Error clearing completed tasks: ${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