Skip to main content
Glama
arpitbatra123

Google Tasks MCP Server

list-tasks

Retrieve all tasks from a Google Tasks list, with options to filter by completion status, visibility, and deletion state.

Instructions

List all tasks in a task list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tasklistYesTask list ID
showCompletedNoWhether to include completed tasks
showHiddenNoWhether to include hidden tasks
showDeletedNoWhether to include deleted tasks

Implementation Reference

  • Full implementation of the 'list-tasks' tool handler, including input schema, registration, and execution logic using Google Tasks API to list tasks with optional filters.
    server.tool(
      "list-tasks",
      "List all tasks in a task list",
      {
        tasklist: z.string().describe("Task list ID"),
        showCompleted: z
          .boolean()
          .optional()
          .describe("Whether to include completed tasks"),
        showHidden: z
          .boolean()
          .optional()
          .describe("Whether to include hidden tasks"),
        showDeleted: z
          .boolean()
          .optional()
          .describe("Whether to include deleted tasks"),
      },
      async ({
        tasklist,
        showCompleted = true,
        showHidden = false,
        showDeleted = false,
      }) => {
        if (!isAuthenticated()) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: "Not authenticated. Please use the 'authenticate' tool first.",
              },
            ],
          };
        }
    
        try {
          const response: any = await tasks.tasks.list({
            tasklist,
            showCompleted,
            showHidden,
            showDeleted,
          });
    
          const tasksResponse = response.data.items || [];
    
          if (tasksResponse.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: "No tasks found in this list.",
                },
              ],
            };
          }
    
          const formattedTasks = tasksResponse.map((task: any) => ({
            id: task.id,
            title: task.title,
            status: task.status,
            due: task.due,
            notes: task.notes,
            completed: task.completed,
          }));
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(formattedTasks, null, 2),
              },
            ],
          };
        } catch (error) {
          console.error("Error listing tasks:", error);
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Error listing 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