Skip to main content
Glama

check_image_status

Monitor the progress of AI image generation tasks by providing the task ID from generate_image to track completion status.

Instructions

Check the status of an image generation task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesThe task ID returned from generate_image

Implementation Reference

  • MCP tool handler for 'check_image_status'. Retrieves image task status from KlingClient, formats detailed status text including URLs and dimensions if successful, and returns as text content.
    case 'check_image_status': {
      const status = await klingClient.getImageTaskStatus(args.task_id as string);
      
      let statusText = `Task ID: ${status.task_id}\nStatus: ${status.task_status}`;
      
      if (status.task_status_msg) {
        statusText += `\nMessage: ${status.task_status_msg}`;
      }
      
      if (status.task_status === 'succeed' && status.task_result?.images) {
        statusText += '\n\nGenerated Images:';
        status.task_result.images.forEach((image: any, index: number) => {
          statusText += `\n\nImage ${index + 1}:`;
          statusText += `\n- URL: ${image.url}`;
          if (image.width && image.height) {
            statusText += `\n- Dimensions: ${image.width}x${image.height}`;
          }
        });
        statusText += '\n\nNote: Images will be cleared after 30 days for security.';
      }
      
      return {
        content: [
          {
            type: 'text',
            text: statusText,
          },
        ],
      };
    }
  • Tool schema definition including name, description, and input schema requiring 'task_id'.
      name: 'check_image_status',
      description: 'Check the status of an image generation task',
      inputSchema: {
        type: 'object',
        properties: {
          task_id: {
            type: 'string',
            description: 'The task ID returned from generate_image',
          },
        },
        required: ['task_id'],
      },
    },
  • Helper method in KlingClient that makes the API GET request to check image generation task status and handles errors.
    async getImageTaskStatus(taskId: string): Promise<any> {
      const path = `/v1/image/generation/${taskId}`;
    
      try {
        const response = await this.axiosInstance.get(path);
        return response.data.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`Kling API error: ${error.response?.data?.message || error.message}`);
        }
        throw error;
      }
    }

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/199-mcp/mcp-kling'

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