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);
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but lacks critical behavioral details. It mentions archiving moves requests to a separate file, but doesn't specify if this is reversible, what permissions are needed, whether it's destructive to original data, or what happens on failure. For a mutation tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with three sentences: purpose, parameter logic, and rationale. Each sentence adds value without redundancy, though the third sentence slightly rephrases the first, making it slightly less than perfectly concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a single parameter with full schema coverage, the description covers basic purpose and parameter logic adequately. However, for a mutation tool that likely changes system state, it should provide more behavioral context like reversibility or error handling to be fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context beyond the schema's 100% coverage by explaining the conditional logic: if requestIds is provided, only those are archived; if not, all completed requests are archived. This clarifies the parameter's semantic impact, though it doesn't add format or validation details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool archives completed requests to keep the active tasks file clean, specifying the verb (archive) and resource (completed requests). It distinguishes from siblings like list_requests or restore_archived_request by focusing on archiving, though it doesn't explicitly contrast with them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when wanting to clean the active tasks file by moving completed work to archive storage. It doesn't provide explicit when-not-to-use guidance or name alternatives like list_archived_requests for checking archives, leaving usage context somewhat inferred rather than clearly defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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