get_points
Retrieve remaining points balance using your API key for the Ghibli Video MCP Server, enabling access to Ghibli-style animated video creation.
Instructions
Get remaining points
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | Yes | API key for authentication |
Implementation Reference
- src/ghibli.ts:123-147 (handler)The core handler function `getPoints` in GhibliClient class that makes a GET request to `/api/user/credits` endpoint to retrieve the user's remaining points/credits.async getPoints(apiKey: string): Promise<number> { // 打印请求信息 process.stderr.write(`\n[Request] GET ${this.baseUrl}/api/user/credits\n`); process.stderr.write(`[Headers] ${JSON.stringify(this.getHeaders(apiKey), null, 2)}\n`); const response = await fetch(`${this.baseUrl}/api/user/credits`, { 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?.left_credits || 0; }
- src/index.ts:80-93 (registration)Tool registration in the ListTools response, defining the name, description, and input schema for the 'get_points' tool.{ name: "get_points", description: "Get remaining points", inputSchema: { type: "object", properties: { api_key: { type: "string", description: "API key for authentication" } }, required: ["api_key"] } },
- src/index.ts:157-176 (handler)The MCP CallTool handler case for 'get_points' that validates input, calls the GhibliClient.getPoints, and formats the response.case "get_points": { const apiKey = String(request.params.arguments?.api_key); if (!apiKey) { throw new Error("API key cannot be empty"); } try { const points = await ghibliClient.getPoints(apiKey); return { content: [{ type: "text", text: `Remaining points: ${points}` }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; throw new Error(`Get points failed: ${errorMessage}`); } }
- src/index.ts:83-92 (schema)The input schema definition for the 'get_points' tool, specifying the required 'api_key' parameter.inputSchema: { type: "object", properties: { api_key: { type: "string", description: "API key for authentication" } }, required: ["api_key"] }