activate_license
Activate a software license by providing a license key, hardware ID, and product code. This tool integrates with LicenseSpring APIs to manage licensing operations effectively.
Instructions
Activate a license with hardware ID and product code
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hardware_id | Yes | ||
| license_key | Yes | ||
| product | Yes | ||
| quantity | No |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"hardware_id": {
"minLength": 1,
"type": "string"
},
"license_key": {
"minLength": 1,
"type": "string"
},
"product": {
"minLength": 1,
"type": "string"
},
"quantity": {
"default": 1,
"type": "number"
}
},
"required": [
"license_key",
"hardware_id",
"product"
],
"type": "object"
}
Implementation Reference
- src/license-api-server.ts:228-252 (handler)The async handler function that executes the activate_license tool logic by posting to the LicenseSpring API endpoint and formatting the response or error.}, async ({ license_key, hardware_id, product, quantity }) => { try { const response = await apiClient.post('/api/v4/activate_license', { license_key, hardware_id, product, quantity, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2), }], }; } catch (error) { return { content: [{ type: 'text', text: `Error activating license: ${handleApiError(error)}`, }], isError: true, }; } });
- src/license-api-server.ts:222-227 (schema)Runtime Zod schema defining input parameters for the activate_license 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'), quantity: z.number().optional().default(1), },
- src/license-api-server.ts:219-252 (registration)Registration of the 'activate_license' MCP tool with title, description, input schema, and inline handler function.server.registerTool('activate_license', { title: 'Activate License', description: 'Activate a license with hardware ID and product code', 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'), quantity: z.number().optional().default(1), }, }, async ({ license_key, hardware_id, product, quantity }) => { try { const response = await apiClient.post('/api/v4/activate_license', { license_key, hardware_id, product, quantity, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2), }], }; } catch (error) { return { content: [{ type: 'text', text: `Error activating license: ${handleApiError(error)}`, }], isError: true, }; } });
- src/types/index.ts:20-25 (schema)TypeScript type interface defining the structure of the ActivateLicenseRequest used in the tool.export interface ActivateLicenseRequest { license_key: string; hardware_id: string; product: string; quantity?: number; }