Skip to main content
Glama

get_task_result

Read-only

Retrieve final results from completed AI tasks using the task ID, enabling access to processed outcomes in complex workflows.

Instructions

Get the final result of a completed task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesThe task ID returned from run_task

Implementation Reference

  • Handler function that executes the get_task_result tool. Retrieves the task using TaskManager.getTask and returns the output if the task is completed, failed, or cancelled.
    case 'get_task_result': {
        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`);
        }
    
        if (
            task.status !== 'completed' &&
            task.status !== 'failed' &&
            task.status !== 'cancelled'
        ) {
            throw new Error(
                `Task ${args.task_id} is not complete. Status: ${task.status}`
            );
        }
    
        return {
            content: [
                {
                    type: 'text',
                    text: task.output || 'No output available',
                },
            ],
        };
    }
  • Input schema and metadata definition for the get_task_result tool.
    const GET_TASK_RESULT_TOOL: Tool = {
        name: 'get_task_result',
        description: 'Get the final result of a completed task.',
        annotations: {
            title: 'Get Task Result',
            readOnlyHint: true, // Only reads completed task result
            destructiveHint: false, // Doesn't modify or destroy data
            idempotentHint: false, // task_id returns result 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:558-579 (registration)
    Registration of get_task_result in the list of available tools returned by ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
        if (process.env.MCP_MODE !== 'true') {
            logger.debug('Received ListTools request');
        }
        const response = {
            tools: [
                RUN_TASK_TOOL,
                CHECK_TASK_STATUS_TOOL,
                GET_TASK_RESULT_TOOL,
                CANCEL_TASK_TOOL,
                WAIT_FOR_TASK_TOOL,
                LIST_TASKS_TOOL,
            ],
        };
        if (process.env.MCP_MODE !== 'true') {
            logger.debug(
                'Returning tools:',
                response.tools.map(t => t.name)
            );
        }
        return response;
    });
  • TaskManager.getTask method used by the handler to retrieve task information.
    public getTask(taskId: string): TaskInfo | undefined {
        return this.tasks.get(taskId);
    }
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, openWorldHint=false, and idempotentHint=false, covering safety and idempotency. The description adds minimal behavioral context by specifying 'completed task,' which hints at a prerequisite state, but doesn't elaborate on error handling, rate limits, or return format. With annotations doing heavy lifting, this earns a baseline score for adding some value.

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 a single, clear sentence with zero waste, front-loading the essential action and target. It's appropriately sized for a simple tool, making it easy for an agent to parse quickly without unnecessary elaboration.

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 the tool's low complexity (one parameter, no output schema) and rich annotations, the description is minimally adequate. It states the purpose but lacks details on return values, error cases, or sibling differentiation. For a read-only tool with good annotations, this is passable but leaves gaps in usage context.

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?

Schema description coverage is 100%, with the 'task_id' parameter fully documented as 'The task ID returned from run_task.' The description adds no additional parameter details beyond what the schema provides, so it meets the baseline for high schema coverage without compensating with extra semantics.

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 action ('Get') and target ('final result of a completed task'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'check_task_status' or 'wait_for_task', which might also retrieve task-related information, so it misses the highest score for sibling distinction.

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

Usage Guidelines2/5

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

The description implies usage for completed tasks but provides no explicit guidance on when to use this tool versus alternatives like 'check_task_status' for pending tasks or 'wait_for_task' for blocking. There's no mention of prerequisites, exclusions, or named alternatives, leaving the agent to infer context.

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