Skip to main content
Glama

archive_completed_requests

Archive completed requests to a separate file, keeping the active tasks file clean by moving finished work to archive storage.

Instructions

Archive completed requests to a separate file to keep the active tasks file clean.

If 'requestIds' is provided, only those specific completed requests will be archived. If 'requestIds' is not provided, all completed requests will be archived.

This addresses the need to keep active tasks file uncluttered by moving completed work to archive storage.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestIdsNoOptional array of specific request IDs to archive. If not provided, all completed requests will be archived.

Implementation Reference

  • MCP tool handler: extracts optional requestIds from args and calls TaskFlowService.archiveCompletedRequests
    async archive_completed_requests(args: any) { const { requestIds } = args ?? {}; return service.archiveCompletedRequests(requestIds); },
  • Tool specification including name, description, and input schema for optional requestIds array.
    export const ARCHIVE_COMPLETED_REQUESTS_TOOL: Tool = { name: "archive_completed_requests", description: "Archive completed requests to a separate file to keep the active tasks file clean.\n\n" + "If 'requestIds' is provided, only those specific completed requests will be archived.\n" + "If 'requestIds' is not provided, all completed requests will be archived.\n\n" + "This addresses the need to keep active tasks file uncluttered by moving completed work to archive storage.", inputSchema: { type: "object", properties: { requestIds: { type: "array", items: { type: "string" }, description: "Optional array of specific request IDs to archive. If not provided, all completed requests will be archived." }, }, }, };
  • Core service method implementing the archiving logic: loads active tasks and archive files, identifies completed requests, moves them to archive file, saves both files, returns summary.
    public async archiveCompletedRequests(requestIds?: string[], mode: "manual" | "auto" = "manual") { await this.loadTasks(); const archive = await this.loadArchive(); let requestsToArchive: RequestEntry[]; if (requestIds && requestIds.length > 0) { // Archive specific requests requestsToArchive = this.data.requests.filter(req => requestIds.includes(req.requestId) && req.completed ); if (requestsToArchive.length === 0) { return { status: "no_completed_requests", message: "No completed requests found with the specified IDs." }; } } else { // Archive all completed requests requestsToArchive = this.data.requests.filter(req => req.completed); if (requestsToArchive.length === 0) { return { status: "no_completed_requests", message: "No completed requests found to archive." }; } } // Convert to archived format and add to archive const archivedRequests = requestsToArchive.map(req => this.createArchivedRequest(req)); archive.archivedRequests.push(...archivedRequests); // Update archive info archive.archiveInfo.lastArchivedAt = new Date().toISOString(); archive.archiveInfo.totalArchivedRequests = archive.archivedRequests.length; // Remove archived requests from active tasks this.data.requests = this.data.requests.filter(req => !requestsToArchive.some(archived => archived.requestId === req.requestId) ); await this.saveArchive(archive); await this.saveTasks(); return { status: "archived", archivedCount: archivedRequests.length, archivedRequests: archivedRequests.map(req => ({ requestId: req.originalRequestId, originalRequest: req.originalRequest, archivedAt: req.archivedAt })), message: `Successfully archived ${archivedRequests.length} completed request(s).`, archiveFilePath: ARCHIVE_FILE_PATH }; }
  • Server registration: tool is included in the list returned by listTools handler, and handlers are bound via taskflowHandlers(service).
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ PLAN_TASK_TOOL, GET_NEXT_TASK_TOOL, MARK_TASK_DONE_TOOL, OPEN_TASK_DETAILS_TOOL, LIST_REQUESTS_TOOL, ADD_TASKS_TO_REQUEST_TOOL, UPDATE_TASK_TOOL, DELETE_TASK_TOOL, ADD_SUBTASKS_TOOL, MARK_SUBTASK_DONE_TOOL, UPDATE_SUBTASK_TOOL, DELETE_SUBTASK_TOOL, EXPORT_TASK_STATUS_TOOL, ADD_NOTE_TOOL, UPDATE_NOTE_TOOL, DELETE_NOTE_TOOL, ADD_DEPENDENCY_TOOL, GET_PROMPTS_TOOL, SET_PROMPTS_TOOL, UPDATE_PROMPTS_TOOL, REMOVE_PROMPTS_TOOL, ARCHIVE_COMPLETED_REQUESTS_TOOL, LIST_ARCHIVED_REQUESTS_TOOL, RESTORE_ARCHIVED_REQUEST_TOOL, ],
  • Handler function provided by taskflowHandlers, dynamically routed in server CallToolRequestSchema handler.
    async archive_completed_requests(args: any) { const { requestIds } = args ?? {}; return service.archiveCompletedRequests(requestIds); },

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/pinkpixel-dev/taskflow-mcp'

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