Skip to main content
Glama

add_consumption

Increase consumption units for a specific license by providing the license key, hardware ID, product, and consumption value. Manage overages and usage limits effectively with this tool.

Instructions

Add consumption units to a license

Input Schema

NameRequiredDescriptionDefault
allow_overagesNo
consumptionsYes
hardware_idYes
license_keyYes
max_overagesNo
productYes

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "allow_overages": { "type": "boolean" }, "consumptions": { "minimum": 1, "type": "number" }, "hardware_id": { "minLength": 1, "type": "string" }, "license_key": { "minLength": 1, "type": "string" }, "max_overages": { "type": "number" }, "product": { "minLength": 1, "type": "string" } }, "required": [ "license_key", "hardware_id", "product", "consumptions" ], "type": "object" }

Implementation Reference

  • The handler function that implements the 'add_consumption' tool logic. It sends a POST request to the LicenseSpring License API endpoint '/api/v4/add_consumption' with the provided parameters and returns the API response or error.
    }, async ({ license_key, hardware_id, product, consumptions, max_overages, allow_overages }) => { try { const response = await apiClient.post('/api/v4/add_consumption', { license_key, hardware_id, product, consumptions, max_overages, allow_overages, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2), }], }; } catch (error) { return { content: [{ type: 'text', text: `Error adding consumption: ${handleApiError(error)}`, }], isError: true, }; }
  • Zod input schema validation for the 'add_consumption' tool parameters.
    inputSchema: { license_key: z.string().min(1, 'License key is required'), hardware_id: z.string().min(1, 'Hardware ID is required'), product: z.string().min(1, 'Product code is required'), consumptions: z.number().min(1, 'Consumption units must be positive'), max_overages: z.number().optional(), allow_overages: z.boolean().optional(), },
  • Registration of the 'add_consumption' MCP tool with schema and handler function.
    server.registerTool('add_consumption', { title: 'Add Consumption', description: 'Add consumption units to a license', inputSchema: { license_key: z.string().min(1, 'License key is required'), hardware_id: z.string().min(1, 'Hardware ID is required'), product: z.string().min(1, 'Product code is required'), consumptions: z.number().min(1, 'Consumption units must be positive'), max_overages: z.number().optional(), allow_overages: z.boolean().optional(), }, }, async ({ license_key, hardware_id, product, consumptions, max_overages, allow_overages }) => { try { const response = await apiClient.post('/api/v4/add_consumption', { license_key, hardware_id, product, consumptions, max_overages, allow_overages, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2), }], }; } catch (error) { return { content: [{ type: 'text', text: `Error adding consumption: ${handleApiError(error)}`, }], isError: true, }; } });
  • TypeScript interface defining the request shape for add_consumption, used for typing the API client requests.
    export interface AddConsumptionRequest { license_key: string; hardware_id: string; product: string; consumptions: number; max_overages?: number; allow_overages?: boolean; }

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/stier1ba/licensespring-mcp'

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