Skip to main content
Glama

list_tasks

Track and manage Kling AI video generation tasks by viewing task history, checking statuses, and applying filters for date range or status. Supports pagination for efficient task browsing.

Instructions

List all your Kling AI generation tasks with filtering options. View task history, check statuses, and filter by date range or status. Supports pagination for browsing through large task lists.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_timeNoFilter tasks created before this time (ISO 8601 format)
pageNoPage number for pagination (default: 1)
page_sizeNoNumber of tasks per page (default: 10, max: 100)
start_timeNoFilter tasks created after this time (ISO 8601 format)
statusNoFilter tasks by status

Implementation Reference

  • The core handler function that makes the API call to list Kling AI tasks with optional filtering and pagination parameters.
    async listTasks(params?: TaskListParams): Promise<any> { const path = '/v1/task/list'; const queryParams = { page: params?.page || 1, page_size: params?.page_size || 10, ...(params?.status && { status: params.status }), ...(params?.start_time && { start_time: params.start_time }), ...(params?.end_time && { end_time: params.end_time }), }; try { const response = await this.axiosInstance.get(path, { params: queryParams }); return response.data.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Kling API error: ${error.response?.data?.message || error.message}`); } throw error; } }
  • Type definition for the input parameters used by the listTasks tool.
    export interface TaskListParams { page?: number; page_size?: number; status?: 'submitted' | 'processing' | 'succeed' | 'failed'; start_time?: string; end_time?: string; }
  • src/index.ts:431-464 (registration)
    MCP tool registration including name, description, and input schema validation.
    { name: 'list_tasks', description: 'List all your Kling AI generation tasks with filtering options. View task history, check statuses, and filter by date range or status. Supports pagination for browsing through large task lists.', inputSchema: { type: 'object', properties: { page: { type: 'number', description: 'Page number for pagination (default: 1)', minimum: 1, }, page_size: { type: 'number', description: 'Number of tasks per page (default: 10, max: 100)', minimum: 1, maximum: 100, }, status: { type: 'string', enum: ['submitted', 'processing', 'succeed', 'failed'], description: 'Filter tasks by status', }, start_time: { type: 'string', description: 'Filter tasks created after this time (ISO 8601 format)', }, end_time: { type: 'string', description: 'Filter tasks created before this time (ISO 8601 format)', }, }, required: [], }, },
  • MCP server request handler that processes list_tasks calls, invokes the KlingClient, formats the response, and returns it in MCP format.
    case 'list_tasks': { const params: TaskListParams = { page: args.page as number, page_size: args.page_size as number, status: args.status as 'submitted' | 'processing' | 'succeed' | 'failed', start_time: args.start_time as string, end_time: args.end_time as string, }; const taskList = await klingClient.listTasks(params); let tasksText = `Kling AI Task List (Page ${params.page || 1}):\n`; tasksText += `\nTotal Tasks: ${taskList.total || 0}`; if (taskList.tasks && taskList.tasks.length > 0) { tasksText += '\n\nTasks:'; taskList.tasks.forEach((task: any, index: number) => { tasksText += `\n\n${index + 1}. Task ID: ${task.task_id}`; tasksText += `\n Type: ${task.task_type || 'N/A'}`; tasksText += `\n Status: ${task.task_status}`; tasksText += `\n Created: ${new Date(task.created_at * 1000).toLocaleString()}`; if (task.updated_at) { tasksText += `\n Updated: ${new Date(task.updated_at * 1000).toLocaleString()}`; } if (task.model_name) { tasksText += `\n Model: ${task.model_name}`; } }); } else { tasksText += '\n\nNo tasks found.'; } return { content: [ { type: 'text', text: tasksText, }, ], }; }

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