Skip to main content
Glama

read a batch

batches_get
Read-onlyIdempotent

Read a sync batch by ID to check its status, metrics, output URL, and per-item results. Use it to monitor a batch you created and decide when to fetch final outputs.

Instructions

Read one sync. batch by id: its status, metrics and outputUrl, and once it is COMPLETED or FAILED, one results row per item (requestId, generation status, generationId, and outputMediaUrl or error). Use it to follow a batch you created; to find a batch id or check which batches are running use batches_list, and for one item's full generation details pass its generationId to generations_get.

With wait: true it polls for up to about 50 seconds until the batch finishes, sending progress notifications when the client asks for them. Reading a finished batch's result file can add up to 30 seconds more. Batches can take hours, so call again while it runs and never create the batch again.

results: failed keeps only FAILED, REJECTED or NO_OP rows, and none skips reading the file. If the file cannot be read (for example too large or too slow), resultsError says why and the batch fields are still current; download outputUrl or find the generations with generations_list instead.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "id": "<id>"
    },
    "name": "batches_get"
  }
}

Input Schema

NameRequiredDescriptionDefault
idYesThe batch id batches_create or batches_list returned.
waitNoPoll until the batch is COMPLETED or FAILED or about 50 seconds pass, then return its latest state; reading a finished batch's result file can take up to 30 seconds more. If it is still running, call again with wait: true instead of sleeping.
resultsNoOnce the batch finishes, which result rows to return: all (default), failed (FAILED, REJECTED or NO_OP only) or none.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.3.31
    • changedInput schema / properties / results / description
      Previous value: -"Once the batch finishes, which result rows to return: all (default), failed (FAILED or REJECTED only) or none."New value: +"Once the batch finishes, which result rows to return: all (default), failed (FAILED, REJECTED or NO_OP only) or none."
    • changedOutput schema / anyOf
      Previous value: -[
      -  {
      -    "$schema": "https://json-schema.org/draft/2020-12/schema",
      -    "additionalProperties": false,
      -    "properties": {
      -      "created_at": {
      -        "type": "string"
      -      },
      -      "id": {
      -        "description": "The batch id; pass it to batches_get.",
      -        "type": "string"
      -      },
      -      "metrics": {
      -        "additionalProperties": {},
      -        "description": "Generation counts: total, succeeded, failed and still pending.",
      -        "properties": {
      -          "failed_count": {
      -            "type": "number"
      -          },
      -          "pending_count": {
      -            "type": "number"
      -          },
      -          "success_count": {
      -            "type": "number"
      -          },
      -          "total_generations": {
      -            "type": "number"
      -          }
      -        },
      -        "type": "object"
      -      },
      -      "outputUrl": {
      -        "description": "The JSONL result file once the batch finishes; empty while it runs.",
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      },
      -      "results": {
      -        "description": "One row per item from the result file, once the batch finishes.",
      -        "items": {
      -          "additionalProperties": false,
      -          "properties": {
      -            "error": {},
      -            "generationId": {
      -              "description": "Read it with generations_get.",
      -              "type": "string"
      -            },
      -            "outputMediaUrl": {
      -              "description": "The finished video; return it verbatim.",
      -              "type": "string"
      -            },
      -            "requestId": {
      -              "type": "string"
      -            },
      -            "status": {
      -              "description": "The generation status: COMPLETED, FAILED or REJECTED.",
      -              "type": "string"
      -            }
      -          },
      -          "required": [
      -            "requestId",
      -            "status"
      -          ],
      -          "type": "object"
      -        },
      -        "type": "array"
      -      },
      -      "resultsError": {
      -        "description": "Why the result file could not be read; the batch fields are still current.",
      -        "type": "string"
      -      },
      -      "status": {
      -        "description": "PENDING, JOBS_CREATED or PROCESSING while running (internal states also mean running); COMPLETED or FAILED when done.",
      -        "type": "string"
      -      },
      -      "webhookUrl": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      }
      -    },
      -    "required": [
      -      "id",
      -      "status"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "$schema": "https://json-schema.org/draft/2020-12/schema",
      -    "additionalProperties": false,
      -    "properties": {
      -      "error": {
      -        "additionalProperties": false,
      -        "properties": {
      -          "code": {
      -            "type": "string"
      -          },
      -          "generationId": {
      -            "type": "string"
      -          },
      -          "importJobId": {
      -            "format": "uuid",
      -            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      -            "type": "string"
      -          },
      -          "importStatus": {
      -            "enum": [
      -              "queued",
      -              "downloading",
      -              "processing",
      -              "completed",
      -              "failed"
      -            ],
      -            "type": "string"
      -          },
      -          "message": {
      -            "type": "string"
      -          },
      -          "progress": {
      -            "maximum": 100,
      -            "minimum": 0,
      -            "type": "number"
      -          },
      -          "retryAfterMs": {
      -            "type": "number"
      -          },
      -          "retryable": {
      -            "type": "boolean"
      -          },
      -          "status": {
      -            "maximum": 9007199254740991,
      -            "minimum": -9007199254740991,
      -            "type": "integer"
      -          }
      -        },
      -        "required": [
      -          "message"
      -        ],
      -        "type": "object"
      -      }
      -    },
      -    "required": [
      -      "error"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "$schema": "https://json-schema.org/draft/2020-12/schema",
      +    "additionalProperties": false,
      +    "properties": {
      +      "created_at": {
      +        "type": "string"
      +      },
      +      "id": {
      +        "description": "The batch id; pass it to batches_get.",
      +        "type": "string"
      +      },
      +      "metrics": {
      +        "additionalProperties": {},
      +        "description": "Generation counts: total, succeeded, failed and still pending.",
      +        "properties": {
      +          "failed_count": {
      +            "type": "number"
      +          },
      +          "pending_count": {
      +            "type": "number"
      +          },
      +          "success_count": {
      +            "type": "number"
      +          },
      +          "total_generations": {
      +            "type": "number"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "outputUrl": {
      +        "description": "The JSONL result file once the batch finishes; empty while it runs.",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "results": {
      +        "description": "One row per item from the result file, once the batch finishes.",
      +        "items": {
      +          "additionalProperties": false,
      +          "properties": {
      +            "error": {},
      +            "generationId": {
      +              "description": "Read it with generations_get.",
      +              "type": "string"
      +            },
      +            "outputMediaUrl": {
      +              "description": "The finished video; return it verbatim. For NO_OP it is the unchanged input, not a lipsync result.",
      +              "type": "string"
      +            },
      +            "requestId": {
      +              "type": "string"
      +            },
      +            "status": {
      +              "description": "The generation status: COMPLETED, NO_OP (finished but lip-synced no frame; error says why), FAILED or REJECTED.",
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "requestId",
      +            "status"
      +          ],
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "resultsError": {
      +        "description": "Why the result file could not be read; the batch fields are still current.",
      +        "type": "string"
      +      },
      +      "status": {
      +        "description": "PENDING, JOBS_CREATED or PROCESSING while running (internal states also mean running); COMPLETED or FAILED when done.",
      +        "type": "string"
      +      },
      +      "webhookUrl": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      }
      +    },
      +    "required": [
      +      "id",
      +      "status"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "$schema": "https://json-schema.org/draft/2020-12/schema",
      +    "additionalProperties": false,
      +    "properties": {
      +      "error": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "code": {
      +            "type": "string"
      +          },
      +          "generationId": {
      +            "type": "string"
      +          },
      +          "importJobId": {
      +            "format": "uuid",
      +            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      +            "type": "string"
      +          },
      +          "importStatus": {
      +            "enum": [
      +              "queued",
      +              "downloading",
      +              "processing",
      +              "completed",
      +              "failed"
      +            ],
      +            "type": "string"
      +          },
      +          "message": {
      +            "type": "string"
      +          },
      +          "progress": {
      +            "maximum": 100,
      +            "minimum": 0,
      +            "type": "number"
      +          },
      +          "retryAfterMs": {
      +            "type": "number"
      +          },
      +          "retryable": {
      +            "type": "boolean"
      +          },
      +          "status": {
      +            "maximum": 9007199254740991,
      +            "minimum": -9007199254740991,
      +            "type": "integer"
      +          }
      +        },
      +        "required": [
      +          "message"
      +        ],
      +        "type": "object"
      +      }
      +    },
      +    "required": [
      +      "error"
      +    ],
      +    "type": "object"
      +  }
      +]
  2. Changed1 schema field changedv0.2.4
    • changedInput schema / properties / wait / description
      Previous value: -"Wait on the server until the job finishes or about 50 seconds pass, then return its latest state. If it is still running, call again with wait: true instead of sleeping."New value: +"Poll until the batch is COMPLETED or FAILED or about 50 seconds pass, then return its latest state; reading a finished batch's result file can take up to 30 seconds more. If it is still running, call again with wait: true instead of sleeping."
  3. Addedv0.1.5

TDQS

A4.6/5.0
Behavior4/5

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

Annotations cover safety (readOnly, idempotent, non-destructive), and the description still adds substantial behavior: polling capped near 50 seconds with progress notifications, an extra ~30 seconds for result-file reads, batches lasting hours, and resultsError surfacing when the file is too large or too slow. The remaining gap is modest (e.g., rate/notification specifics), but the async lifecycle is well disclosed.

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?

Front-loaded with the core action and return shape, and every sentence carries information (alternatives, polling bounds, resultsError handling). It runs long across three blocks and repeats some wait timing already stated in the schema, which keeps it from a perfect score.

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

Completeness5/5

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

Covers the full complexity of an async, long-running batch read: polling behavior, partial-result failure mode, and sibling routing for id discovery and per-item follow-up. An output schema exists, and the description's return-value summary plus resultsError explanation is complementary rather than redundant.

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?

Schema coverage is 100%, so baseline is 3; the description earns one more by explaining consequences the schema does not — 'results: failed' keeps FAILED/REJECTED/NO_OP rows and 'none' skips reading the file entirely, and 'wait' polling is bounded at ~50s with an extra ~30s for file reads. That adds semantic weight beyond the enum labels.

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?

Names a specific verb and resource (read one sync batch by id) and spells out the payload: status, metrics, outputUrl, plus per-item result rows (requestId, status, generationId, outputMediaUrl or error) once COMPLETED/FAILED. It explicitly separates itself from batches_list (finding ids, running batches) and generations_get (one item's details).

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

Usage Guidelines5/5

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

Gives direct when-to-use ('use it to follow a batch you created') and names the alternatives with the condition that selects each: batches_list for ids/running batches, generations_get with a generationId for item detail. It also adds a concrete retry rule — call again with wait while running, never re-create the batch — and a fallback path via outputUrl or generations_list when the result file is unreadable.

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