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;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a read-only operation by using 'Get' and describes the type of information returned, but does not specify authentication requirements, rate limits, or potential errors. The description adds some context about usage monitoring but lacks detailed behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured in two sentences: the first states the purpose and details retrieved, and the second provides usage context. Every sentence adds value without waste, making it appropriately sized and front-loaded for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple read operation with no parameters) and lack of annotations or output schema, the description is adequate but has gaps. It explains what information is retrieved but does not describe the return format, potential errors, or authentication needs, leaving some contextual information incomplete for a tool without structured support.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so no parameter information is needed in the description. The description appropriately focuses on the tool's purpose and usage without redundant parameter details, earning a baseline score of 4 for this dimension.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Get detailed information') and resources ('Kling AI resource packages'), and distinguishes it from siblings by focusing on usage monitoring rather than content generation or task management. It explicitly mentions what information is retrieved: remaining credits, expiration dates, and package types.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('Useful for monitoring API usage and planning resource allocation'), which helps differentiate it from siblings like get_account_balance or list_tasks. However, it does not explicitly state when not to use it or name specific alternatives, keeping it at a 4 rather than a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/199-mcp/mcp-kling'

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