ig_get_container_status
Retrieve the processing status of a media container to determine if a video has completed processing and is ready for use.
Instructions
Check the processing status of a media container (useful for videos).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| container_id | Yes | Container ID to check |
Implementation Reference
- The handler that executes the ig_get_container_status tool. It calls the Meta Graph API GET /{container_id} with fields id,status,status_code and returns the result.
server.tool( "ig_get_container_status", "Check the processing status of a media container (useful for videos).", { container_id: z.string().describe("Container ID to check"), }, async ({ container_id }) => { try { const { data, rateLimit } = await client.ig("GET", `/${container_id}`, { fields: "id,status,status_code", }); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Get container status failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); - Input schema for ig_get_container_status: requires a container_id string parameter.
{ container_id: z.string().describe("Container ID to check"), }, - src/index.ts:42-42 (registration)Registration of all Instagram publishing tools (including ig_get_container_status) via registerIgPublishingTools call.
registerIgPublishingTools(server, client); - src/tools/instagram/publishing.ts:19-19 (registration)The registerIgPublishingTools function that registers ig_get_container_status along with other publishing tools on the MCP server.
export function registerIgPublishingTools(server: McpServer, client: MetaClient): void { - Helper function waitForContainer that polls container status — notably uses the same client.ig GET /{containerId} endpoint as ig_get_container_status.
/** Poll container status until FINISHED or error (video upload) */ async function waitForContainer(client: MetaClient, containerId: string, maxWait = 30): Promise<void> { const interval = 2000; const maxAttempts = Math.ceil((maxWait * 1000) / interval); for (let i = 0; i < maxAttempts; i++) { const { data } = await client.ig("GET", `/${containerId}`, { fields: "status_code" }); const status = (data as { status_code?: string }).status_code; if (status === "FINISHED") return; if (status === "ERROR") throw new Error("Container processing failed (ERROR status)"); await new Promise((r) => setTimeout(r, interval)); } throw new Error(`Container processing timed out after ${maxWait}s`); }