Skip to main content
Glama
arpitbatra123

Google Tasks MCP Server

list-tasklists

Retrieve and display all task lists from Google Tasks. Ideal for managing and organizing tasks efficiently through the MCP server interface.

Instructions

List all task lists

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the "list-tasklists" tool. It checks authentication, fetches all task lists from Google Tasks API using tasks.tasklists.list(), formats them, and returns as JSON. Handles errors and empty lists.
    server.tool("list-tasklists", "List all task lists", {}, async () => { if (!isAuthenticated()) { return { isError: true, content: [ { type: "text", text: "Not authenticated. Please use the 'authenticate' tool first.", }, ], }; } try { const response = await tasks.tasklists.list(); const taskLists = response.data.items || []; if (taskLists.length === 0) { return { content: [ { type: "text", text: "No task lists found.", }, ], }; } const formattedLists = taskLists.map((list) => ({ id: list.id, title: list.title, updated: list.updated, })); return { content: [ { type: "text", text: JSON.stringify(formattedLists, null, 2), }, ], }; } catch (error) { console.error("Error listing task lists:", error); return { isError: true, content: [ { type: "text", text: `Error listing task lists: ${error}`, }, ], }; } });
  • Helper function used by the tool to check if the user is authenticated with Google OAuth.
    function isAuthenticated() { return credentials !== null; }
  • src/index.ts:188-242 (registration)
    Registers the "list-tasklists" tool with MCP server, providing description, empty input schema, and the handler function.
    server.tool("list-tasklists", "List all task lists", {}, async () => { if (!isAuthenticated()) { return { isError: true, content: [ { type: "text", text: "Not authenticated. Please use the 'authenticate' tool first.", }, ], }; } try { const response = await tasks.tasklists.list(); const taskLists = response.data.items || []; if (taskLists.length === 0) { return { content: [ { type: "text", text: "No task lists found.", }, ], }; } const formattedLists = taskLists.map((list) => ({ id: list.id, title: list.title, updated: list.updated, })); return { content: [ { type: "text", text: JSON.stringify(formattedLists, null, 2), }, ], }; } catch (error) { console.error("Error listing task lists:", error); return { isError: true, content: [ { type: "text", text: `Error listing task lists: ${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