Skip to main content
Glama

get_task_result

Retrieve the result of a specific task by providing the task ID and API key. Used within the Ghibli Video MCP Server to track the progress and outcome of image-to-animation conversions.

Instructions

Get task result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyYesAPI key for authentication
taskIdYesTask ID

Implementation Reference

  • The handler for the 'get_task_result' MCP tool. Validates taskId and api_key parameters, invokes GhibliClient.getTaskResult, and formats the response as MCP content.
    case "get_task_result": { const taskId = String(request.params.arguments?.taskId); const apiKey = String(request.params.arguments?.api_key); if (!taskId) { throw new Error("Task ID cannot be empty"); } if (!apiKey) { throw new Error("API key cannot be empty"); } try { const result = await ghibliClient.getTaskResult(taskId, apiKey); return { content: [{ type: "text", text: `Task result: ${JSON.stringify(result)}` }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; throw new Error(`Get task result failed: ${errorMessage}`); } }
  • src/index.ts:94-111 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the name, description, and input schema for 'get_task_result'.
    { name: "get_task_result", description: "Get task result", inputSchema: { type: "object", properties: { taskId: { type: "string", description: "Task ID" }, api_key: { type: "string", description: "API key for authentication" } }, required: ["taskId", "api_key"] } }
  • GhibliClient helper method that performs the HTTP GET request to retrieve the task result from the external API.
    async getTaskResult(taskId: string, apiKey: string): Promise<TaskResult> { // 打印请求信息 const url = `${this.baseUrl}/api/video/result?task_id=${taskId}`; process.stderr.write(`\n[Request] GET ${url}\n`); process.stderr.write(`[Headers] ${JSON.stringify(this.getHeaders(apiKey), null, 2)}\n`); const response = await fetch(url, { method: 'GET', headers: this.getHeaders(apiKey) }); // 打印响应状态 process.stderr.write(`[Response] Status: ${response.status} ${response.statusText}\n`); if (!response.ok) { const error = `API request failed: ${response.statusText}`; process.stderr.write(`[Error] ${error}\n`); throw new Error(error); } const result = await response.json(); process.stderr.write(`[Response Data] ${JSON.stringify(result, null, 2)}\n`); return result.data; }
  • TypeScript type definition for the TaskResult object returned by the getTaskResult method.
    export type TaskResult = { status: 'pending' | 'completed' | 'failed'; result?: string; error?: string; };

Other Tools

Related Tools

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/MichaelYangjson/mcp-ghibli-video'

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