Skip to main content
Glama

get_resource_packages

Retrieve Kling AI resource package details to monitor API credits, track expiration dates, and plan usage allocation for video generation tasks.

Instructions

Get detailed information about your Kling AI resource packages including remaining credits, expiration dates, and package types. Useful for monitoring API usage and planning resource allocation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that fetches the user's resource packages from the Kling AI API endpoint '/v1/account/packages' and returns them as ResourcePackage[]
    async getResourcePackages(): Promise<ResourcePackage[]> { const path = '/v1/account/packages'; try { const response = await this.axiosInstance.get(path); return response.data.data.resource_packages || []; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Kling API error: ${error.response?.data?.message || error.message}`); } throw error; } }
  • src/index.ts:699-725 (registration)
    MCP tool dispatch handler that calls klingClient.getResourcePackages() and formats the response as a readable text summary of the packages.
    case 'get_resource_packages': { const packages = await klingClient.getResourcePackages(); let packagesText = 'Your Kling AI Resource Packages:\n'; if (packages.length === 0) { packagesText += '\nNo active resource packages found.'; } else { packages.forEach((pkg, index) => { packagesText += `\n\nPackage ${index + 1}:`; packagesText += `\n- Name: ${pkg.name}`; packagesText += `\n- Resource ID: ${pkg.resource_id}`; packagesText += `\n- Amount: ${pkg.amount}`; packagesText += `\n- Expires: ${new Date(pkg.expire_at).toLocaleString()}`; packagesText += `\n- Created: ${new Date(pkg.created_at).toLocaleString()}`; }); } return { content: [ { type: 'text', text: packagesText, }, ], }; }
  • Tool registration in the TOOLS array, including the name, description, and empty inputSchema (no parameters required). Used by ListToolsRequest.
    { name: 'get_resource_packages', description: 'Get detailed information about your Kling AI resource packages including remaining credits, expiration dates, and package types. Useful for monitoring API usage and planning resource allocation.', inputSchema: { type: 'object', properties: {}, required: [], }, },
  • TypeScript interface defining the structure of a ResourcePackage returned by the handler.
    export interface ResourcePackage { resource_id: string; name: string; amount: number; expire_at: string; created_at: string; }

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