Skip to main content
Glama

get_task

Check the status and retrieve results of media generation tasks, including image URLs when processing is complete.

Instructions

Get the status and result of a generation task. Returns image URL when completed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesTask UUID returned from generate_image

Implementation Reference

  • The handler function `_handle_get_task` in `mcp/vap_mcp_proxy.py` implements the logic for the `get_task` tool, fetching data from the V3 API and formatting the result.
    def _handle_get_task(arguments: Dict) -> Dict:
        """
        Handle get_task tool call (Directive #241).
    
        Fetches task status from V3 API with proper video_url extraction.
        """
        task_id = arguments.get("task_id", "")
    
        if not task_id:
            return {
                "isError": True,
                "content": [{"type": "text", "text": "Error: task_id is required"}]
            }
    
        # Fetch task from V3 API
        response = make_v3_get_request(f"/v3/tasks/{task_id}")
    
        if "error" in response:
            return {
                "isError": True,
                "content": [{"type": "text", "text": f"Error: {response['error']}"}]
            }
    
        # Extract fields
        status = response.get("status", "unknown")
        task_type = response.get("type", "unknown")
        estimated_cost = response.get("estimated_cost", "N/A")
        actual_cost = response.get("actual_cost", "N/A")
        error_message = response.get("error_message")
        result = response.get("result", {}) or {}
    
        # Extract output URL (video, image, or audio)
        video_url = result.get("video_url") or result.get("output_url")
        image_url = result.get("image_url") or result.get("output_url")
    
        # D#508: Music tasks have audio_url in items array
        audio_url = None
        items = result.get("items", [])
        if items and isinstance(items, list) and len(items) > 0:
            audio_url = items[0].get("audio_url")
            # Also check for image_url in items (for image tasks)
            if not image_url:
                image_url = items[0].get("image_url")
    
        # Build response text
        lines = [
            f"Task: {task_id}",
            f"Type: {task_type}",
            f"Status: {status}",
            f"Estimated Cost: ${estimated_cost}",
        ]
    
        if actual_cost and actual_cost != "N/A":
            lines.append(f"Actual Cost: ${actual_cost}")
    
        if status == "completed":
            if audio_url:
                lines.append(f"\n🎵 Audio URL: {audio_url}")
            elif video_url:
                lines.append(f"\n🎬 Video URL: {video_url}")
            elif image_url:
                lines.append(f"\n🖼️ Image URL: {image_url}")
        elif status == "failed" and error_message:
            lines.append(f"\n❌ Error: {error_message}")
        elif status in ("pending", "queued", "executing"):
            lines.append(f"\n⏳ Task is still {status}. Check again shortly.")
    
        return {
            "content": [{
                "type": "text",
                "text": "\n".join(lines)
            }]
        }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool returns 'image URL when completed,' which adds useful context about output behavior. However, it doesn't cover other behavioral traits like error handling, polling requirements, or rate limits. The description is adequate but lacks depth for a mutation-free status check tool.

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 extremely concise and front-loaded: two sentences that directly state the tool's purpose and key output. Every word earns its place, with no redundant or vague phrasing. It efficiently communicates essential information without unnecessary detail.

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 (single parameter, no annotations, no output schema), the description is reasonably complete. It covers the basic purpose and output hint ('image URL when completed'). However, it could better address behavioral aspects like task states (e.g., pending, failed) or error cases, which would enhance completeness for a status-checking tool.

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 single parameter 'task_id' well-documented in the schema. The description adds minimal value by referencing 'task_id returned from generate_image,' which clarifies the parameter's origin but doesn't provide additional semantics beyond the schema. 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.

Purpose4/5

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

The description clearly states the tool's purpose: 'Get the status and result of a generation task.' It specifies the verb ('Get') and resource ('generation task'), and distinguishes it from siblings like 'generate_image' (which creates tasks) and 'list_tasks' (which lists multiple tasks). However, it doesn't explicitly differentiate from 'get_operation' (another status-checking tool), keeping it from a perfect score.

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 by mentioning 'task_id returned from generate_image,' suggesting it's used after task creation. However, it lacks explicit guidance on when to use this tool versus alternatives like 'list_tasks' for bulk status checks or 'get_operation' for other operations. No exclusions or prerequisites are stated, leaving some ambiguity.

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/elestirelbilinc-sketch/vap-showcase'

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