Skip to main content
Glama

google_tasks_list_tasks

Retrieve tasks from a specified Google task list, with options to include or exclude completed tasks, for integration and management within AI-driven workflows.

Instructions

List tasks from a task list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
showCompletedNoWhether to include completed tasks
taskListIdNoID of the task list to retrieve tasks from (uses default if not specified)

Implementation Reference

  • Main handler function that validates arguments and delegates to GoogleTasks.listTasks to execute the tool.
    export async function handleTasksListTasks( args: any, googleTasksInstance: GoogleTasks ) { if (!isListTasksArgs(args)) { throw new Error("Invalid arguments for google_tasks_list_tasks"); } const { taskListId, showCompleted } = args; const result = await googleTasksInstance.listTasks(taskListId, showCompleted); return { content: [{ type: "text", text: result }], isError: false, }; }
  • Defines the Tool object with inputSchema for google_tasks_list_tasks.
    export const LIST_TASKS_TOOL: Tool = { name: "google_tasks_list_tasks", description: "List tasks from a task list", inputSchema: { type: "object", properties: { taskListId: { type: "string", description: "ID of the task list to retrieve tasks from (uses default if not specified)", }, showCompleted: { type: "boolean", description: "Whether to include completed tasks", }, }, }, };
  • Dispatches tool calls to the specific handler in the main server request handler.
    case "google_tasks_list_tasks": return await tasksHandlers.handleTasksListTasks( args, googleTasksInstance );
  • Core implementation in GoogleTasks class that calls Google Tasks API to list tasks and formats the output.
    async listTasks(taskListId?: string, showCompleted: boolean = false) { try { const targetTaskList = taskListId || this.defaultTaskList; const response = await this.tasks.tasks.list({ tasklist: targetTaskList, showCompleted: showCompleted, maxResults: 100, }); if (!response.data.items || response.data.items.length === 0) { return `No tasks found in task list: ${targetTaskList}`; } // Format the tasks return response.data.items .map((task: any, index: number) => { const due = task.due ? `Due: ${new Date(task.due).toLocaleString()}` : ""; const completed = task.completed ? `Completed: ${new Date(task.completed).toLocaleString()}` : ""; const status = task.status || ""; return `[${index + 1}] ${task.title} - ID: ${task.id} Status: ${status} ${due} ${completed} ${task.notes ? `Notes: ${task.notes}` : ""}`; }) .join("\n\n"); } catch (error) { throw new Error( `Failed to list tasks: ${ error instanceof Error ? error.message : String(error) }` ); } }
  • Input validation type guard matching the tool's input schema.
    export function isListTasksArgs(args: any): args is { taskListId?: string; showCompleted?: boolean; } { return ( args && (args.taskListId === undefined || typeof args.taskListId === "string") && (args.showCompleted === undefined || typeof args.showCompleted === "boolean") ); }

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/vakharwalad23/google-mcp'

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