add_feature_consumption
Increase consumption units for a specific feature tied to a license key, hardware ID, and product in the LicenseSpring MCP Server.
Instructions
Add consumption units to a specific feature
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| consumptions | Yes | ||
| feature | Yes | ||
| hardware_id | Yes | ||
| license_key | Yes | ||
| product | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"consumptions": {
"minimum": 1,
"type": "number"
},
"feature": {
"minLength": 1,
"type": "string"
},
"hardware_id": {
"minLength": 1,
"type": "string"
},
"license_key": {
"minLength": 1,
"type": "string"
},
"product": {
"minLength": 1,
"type": "string"
}
},
"required": [
"license_key",
"hardware_id",
"product",
"feature",
"consumptions"
],
"type": "object"
}
Implementation Reference
- src/license-api-server.ts:370-395 (handler)The main handler function for the 'add_feature_consumption' tool. It validates input (via schema), makes a POST request to the LicenseSpring API endpoint '/api/v4/add_feature_consumption', and returns the JSON response or an error message.}, async ({ license_key, hardware_id, product, feature, consumptions }) => { try { const response = await apiClient.post('/api/v4/add_feature_consumption', { license_key, hardware_id, product, feature, consumptions, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2), }], }; } catch (error) { return { content: [{ type: 'text', text: `Error adding feature consumption: ${handleApiError(error)}`, }], isError: true, }; } });
- src/license-api-server.ts:363-369 (schema)Zod-based input schema for validating the parameters required by the add_feature_consumption tool.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'), feature: z.string().min(1, 'Feature code is required'), consumptions: z.number().min(1, 'Consumption units must be positive'), },
- src/license-api-server.ts:360-395 (registration)MCP server tool registration call, including title, description, input schema, and inline handler function.server.registerTool('add_feature_consumption', { title: 'Add Feature Consumption', description: 'Add consumption units to a specific feature', 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'), feature: z.string().min(1, 'Feature code is required'), consumptions: z.number().min(1, 'Consumption units must be positive'), }, }, async ({ license_key, hardware_id, product, feature, consumptions }) => { try { const response = await apiClient.post('/api/v4/add_feature_consumption', { license_key, hardware_id, product, feature, consumptions, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2), }], }; } catch (error) { return { content: [{ type: 'text', text: `Error adding feature consumption: ${handleApiError(error)}`, }], isError: true, }; } });
- src/types/index.ts:42-48 (schema)TypeScript type definition for the AddFeatureConsumptionRequest interface, matching the tool's input parameters.export interface AddFeatureConsumptionRequest { license_key: string; hardware_id: string; product: string; feature: string; consumptions: number; }