Skip to main content
Glama

get_points

Check remaining points for converting images to Ghibli-style animated videos using the MCP server.

Instructions

Get remaining points

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyYesAPI key for authentication

Implementation Reference

  • The MCP tool handler for 'get_points', which extracts the api_key from arguments, calls ghibliClient.getPoints, and returns the remaining points as text content.
    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:80-93 (registration)
    Registration of the 'get_points' tool in the ListTools response, including its name, description, and input schema requiring api_key.
    {
      name: "get_points",
      description: "Get remaining points",
      inputSchema: {
        type: "object",
        properties: {
          api_key: {
            type: "string",
            description: "API key for authentication"
          }
        },
        required: ["api_key"]
      }
    },
  • Helper method in GhibliClient that implements the core logic for fetching remaining points (credits) via API GET /api/user/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;
    }
Install Server

Other 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