Skip to main content
Glama

get-archived-tasks

Retrieve archived tasks from Sunsama with pagination controls to manage large collections of completed or historical work items.

Instructions

Get archived tasks with optional pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of tasks to return (defaults to 100)
offsetNoPagination offset (defaults to 0)

Implementation Reference

  • The core handler implementation for the 'get-archived-tasks' tool. It uses pagination (offset/limit), fetches from client.getArchivedTasks, trims tasks, and returns formatted TSV with pagination metadata.
    export const getArchivedTasksTool = withTransportClient({ name: "get-archived-tasks", description: "Get archived tasks with optional pagination", parameters: getArchivedTasksSchema, execute: async ( { offset = 0, limit = 100 }: GetArchivedTasksInput, context: ToolContext, ) => { const requestedLimit = limit; const fetchLimit = requestedLimit + 1; const allTasks = await context.client.getArchivedTasks(offset, fetchLimit); const hasMore = allTasks.length > requestedLimit; const tasks = hasMore ? allTasks.slice(0, requestedLimit) : allTasks; const trimmedTasks = trimTasksForResponse(tasks); const paginationInfo = { offset, limit: requestedLimit, count: tasks.length, hasMore, nextOffset: hasMore ? offset + requestedLimit : null, }; return formatPaginatedTsvResponse(trimmedTasks, paginationInfo); }, });
  • Zod schema defining the input parameters for the tool: optional offset (>=0) and limit (1-1000).
    export const getArchivedTasksSchema = z.object({ offset: z.number().int().min(0).optional().describe( "Pagination offset (defaults to 0)", ), limit: z.number().int().min(1).max(1000).optional().describe( "Maximum number of tasks to return (defaults to 100)", ), });
  • Registers the getArchivedTasksTool as part of the taskTools array export.
    export const taskTools = [ // Query tools getTasksBacklogTool, getTasksByDayTool, getArchivedTasksTool, getTaskByIdTool, // Lifecycle tools createTaskTool, deleteTaskTool, // Update tools updateTaskCompleteTool, updateTaskSnoozeDateTool, updateTaskBacklogTool, updateTaskPlannedTimeTool, updateTaskNotesTool, updateTaskDueDateTool, updateTaskTextTool, updateTaskStreamTool, ];
  • src/tools/index.ts:5-9 (registration)
    Final registration: spreads taskTools (including getArchivedTasksTool) into the allTools array, which is used for MCP server tool registration.
    export const allTools = [ ...userTools, ...taskTools, ...streamTools, ];
  • Imports helper functions like withTransportClient (wraps the handler), formatPaginatedTsvResponse (used in execute for output), and ToolContext type.
    import { formatJsonResponse, formatPaginatedTsvResponse, formatTsvResponse, withTransportClient, type ToolContext, } from "./shared.js";

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/robertn702/mcp-sunsama'

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