runway_getTask
Retrieve task status and results from Runway API operations. Check if video or image generation tasks have completed successfully, failed, or are still processing.
Instructions
Get the details of a task, if the task status is 'SUCCEEDED', there will be a 'url' field in the response. If the task status is 'FAILED', there will be a 'error' field in the response. If the task status is 'PENDING' or 'RUNNING', you can call this tool again in 5 seconds to get the task details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| taskId | Yes |
Input Schema (JSON Schema)
{
"properties": {
"taskId": {
"type": "string"
}
},
"required": [
"taskId"
],
"type": "object"
}
Implementation Reference
- src/index.ts:192-195 (handler)The handler function for the 'runway_getTask' tool. It fetches the task details from the Runway API endpoint `/tasks/${taskId}` using the `callRunway` helper and returns the result as a JSON string in the response content.async ({ taskId }) => { const task = await callRunway(`/tasks/${taskId}`); return { content: [{ type: "text", text: JSON.stringify(task) }] }; }
- src/index.ts:189-191 (schema)The input schema for the 'runway_getTask' tool, defining a single required parameter 'taskId' as a string.{ taskId: z.string(), },
- src/index.ts:186-196 (registration)The registration of the 'runway_getTask' tool on the MCP server, specifying the tool name, description, input schema, and handler function.server.tool( "runway_getTask", "Get the details of a task, if the task status is 'SUCCEEDED', there will be a 'url' field in the response. If the task status is 'FAILED', there will be a 'error' field in the response. If the task status is 'PENDING' or 'RUNNING', you can call this tool again in 5 seconds to get the task details.", { taskId: z.string(), }, async ({ taskId }) => { const task = await callRunway(`/tasks/${taskId}`); return { content: [{ type: "text", text: JSON.stringify(task) }] }; } );
- src/index.ts:27-42 (helper)Helper function used by the 'runway_getTask' handler to make authenticated API calls to the Runway service.async function callRunway( path: string, opts: Partial<RequestInit> = {} ): Promise<unknown> { const res = await fetch(`${API_BASE}${path}`, { ...opts, headers: { Authorization: `Bearer ${SECRET}`, "X-Runway-Version": RUNWAY_VERSION, "Content-Type": "application/json", ...(opts.headers || {}), }, } as RequestInit); if (!res.ok) throw new Error(`Runway ${res.status}: ${await res.text()}`); return res.json(); }