Skip to main content
Glama

check_task_status

Read-only

Monitor the progress and retrieve partial results of a running AI task by providing its task ID, enabling real-time status updates for complex workflows.

Instructions

Check the status of a running task. Returns current status, progress, and partial results if available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesThe task ID returned from run_task

Implementation Reference

  • Handler for check_task_status tool. Retrieves task status from TaskManager, computes live progress, recent activity, warnings for stuck tasks, recommended re-check interval, and returns comprehensive JSON status report.
    case 'check_task_status': {
        if (!args.task_id) {
            throw new Error('task_id is required');
        }
    
        const task = taskManager.getTask(args.task_id);
        if (!task) {
            throw new Error(`Task ${args.task_id} not found`);
        }
    
        // Check for stuck task indicators
        let warningMessage = null;
        if (task.status === 'running') {
            const now = Date.now();
    
            // Check last activity time
            if (task.lastActivityTime) {
                const inactiveTime =
                    now - task.lastActivityTime.getTime();
                if (inactiveTime > 60000) {
                    // 1 minute
                    warningMessage = `Warning: No activity for ${Math.round(inactiveTime / 1000)} seconds`;
                }
            }
    
            // Check runtime
            if (task.startedAt) {
                const runtime = now - task.startedAt.getTime();
                if (runtime > 5 * 60 * 1000) {
                    // 5 minutes
                    warningMessage = `Warning: Task running for ${Math.round(runtime / 60000)} minutes`;
                }
            }
    
            // Check error count
            if (task.errorCount && task.errorCount > 2) {
                warningMessage = `Warning: ${task.errorCount} errors encountered`;
            }
        }
    
        // Calculate recommended check_after based on task runtime
        let recommendedCheckAfter = 120; // Default max of 2 minutes
        if (task.status === 'running' && task.startedAt) {
            const runtimeMs = Date.now() - task.startedAt.getTime();
            const runtimeSeconds = Math.floor(runtimeMs / 1000);
    
            // Progressive backoff: 5s for first 5s, 10s for first 10s, then scale up
            if (runtimeSeconds <= 5) {
                recommendedCheckAfter = 5;
            } else if (runtimeSeconds <= 10) {
                recommendedCheckAfter = 10;
            } else if (runtimeSeconds <= 30) {
                recommendedCheckAfter = 15;
            } else if (runtimeSeconds <= 60) {
                recommendedCheckAfter = 30;
            } else if (runtimeSeconds <= 120) {
                recommendedCheckAfter = 60;
            } else {
                recommendedCheckAfter = 120; // Max 2 minutes for long-running tasks
            }
        }
    
        // Get live progress for running tasks using taskStatus()
        let currentProgress = null;
        if (task.status === 'running') {
            currentProgress = await taskManager.getTaskProgress(
                args.task_id
            );
        }
    
        const activity = taskManager.getTaskActivity(args.task_id);
    
        return {
            content: [
                {
                    type: 'text',
                    text: JSON.stringify(
                        {
                            id: task.id,
                            status: task.status,
                            model: task.model || task.modelClass,
                            readOnly: task.readOnly,
                            createdAt: task.createdAt,
                            startedAt: task.startedAt,
                            completedAt: task.completedAt,
                            output: task.output, // Shows result if complete, error if failed
                            progress: currentProgress || task.progress, // Live status from taskStatus() or cached
                            messageCount: task.messages.length,
                            requestCount: task.requestCount || 0,
                            recentEvents: activity.recentEvents,
                            toolCalls: activity.toolCalls,
                            lastActivity: activity.lastActivity,
                            check_after:
                                task.status === 'running'
                                    ? `Please wait ${recommendedCheckAfter} seconds before checking this task again`
                                    : null,
                            warning: warningMessage,
                            errorCount: task.errorCount,
                            lastError: task.lastError,
                        },
                        null,
                        2
                    ),
                },
            ],
        };
    }
  • Tool schema definition for check_task_status, including name, description, annotations, and input schema requiring task_id.
    const CHECK_TASK_STATUS_TOOL: Tool = {
        name: 'check_task_status',
        description:
            'Check the status of a running task. Returns current status, progress, and partial results if available.',
        annotations: {
            title: 'Check Task Status',
            readOnlyHint: true, // Only reads task status
            destructiveHint: false, // Doesn't modify or destroy data
            idempotentHint: false, // task_id returns status each time
            openWorldHint: false, // Only queries local task state
        },
        inputSchema: {
            type: 'object',
            properties: {
                task_id: {
                    type: 'string',
                    description: 'The task ID returned from run_task',
                },
            },
            required: ['task_id'],
        },
    };
  • src/serve.ts:563-570 (registration)
    Registration of check_task_status in the list of available tools returned by ListToolsRequestSchema handler.
    tools: [
        RUN_TASK_TOOL,
        CHECK_TASK_STATUS_TOOL,
        GET_TASK_RESULT_TOOL,
        CANCEL_TASK_TOOL,
        WAIT_FOR_TASK_TOOL,
        LIST_TASKS_TOOL,
    ],
Behavior4/5

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

Annotations already indicate read-only, non-destructive, non-idempotent, and closed-world behavior. The description adds valuable context by specifying what is returned (current status, progress, partial results if available), which is not covered by annotations. It does not contradict annotations, as checking status aligns with read-only operations, and it provides useful behavioral details beyond the structured data.

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

Conciseness5/5

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

The description is front-loaded and efficiently structured in two sentences: the first states the action and resource, and the second specifies the return values. Every sentence adds essential information without redundancy, making it highly concise and well-organized for quick understanding.

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

Completeness4/5

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

Given the tool's low complexity (one parameter, no output schema) and rich annotations, the description is mostly complete. It covers purpose, return values, and usage hints, but lacks explicit guidance on when to choose this tool over siblings like 'get_task_result', which could improve completeness for an agent in a multi-tool environment.

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

Parameters3/5

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

The input schema has 100% description coverage, clearly documenting the single required parameter 'task_id' as from 'run_task'. The description adds minimal semantic value by referencing 'task_id' indirectly but does not provide additional details like format examples or constraints beyond what the schema already covers. This meets the baseline for high schema coverage.

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

Purpose5/5

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

The description clearly states the specific action ('Check the status') and resource ('a running task'), distinguishing it from siblings like 'cancel_task', 'get_task_result', 'list_tasks', 'run_task', and 'wait_for_task'. It specifies the scope of what is returned (status, progress, partial results), making the purpose unambiguous and differentiated.

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

Usage Guidelines4/5

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

The description implies usage context by mentioning 'a running task' and referencing 'task_id' from 'run_task', suggesting it should be used after initiating a task. However, it does not explicitly state when to use this tool versus alternatives like 'get_task_result' or 'wait_for_task', nor does it provide exclusions or detailed prerequisites, leaving some ambiguity in tool selection.

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/just-every/mcp-task'

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