track_device_variables
Monitor and update custom variables for a device using license key, hardware ID, and product details to enhance license management and tracking capabilities.
Instructions
Track custom variables for a device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hardware_id | Yes | ||
| license_key | Yes | ||
| product | Yes | ||
| variables | Yes |
Implementation Reference
- src/license-api-server.ts:466-490 (handler)Handler function that POSTs the license_key, hardware_id, product, and variables to the LicenseSpring API /api/v4/track_device_variables endpoint, returning the JSON response or formatted error.}, async ({ license_key, hardware_id, product, variables }) => { try { const response = await apiClient.post('/api/v4/track_device_variables', { license_key, hardware_id, product, variables, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2), }], }; } catch (error) { return { content: [{ type: 'text', text: `Error tracking device variables: ${handleApiError(error)}`, }], isError: true, }; } });
- src/license-api-server.ts:458-464 (schema)Input schema definition using Zod validators for the tool parameters: license_key, hardware_id, product, and variables (non-empty record). Includes title and description.title: 'Track Device Variables', description: 'Track custom variables for a device', 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'), variables: z.record(z.string(), z.string()).refine(obj => Object.keys(obj).length > 0, 'At least one variable is required'),
- src/license-api-server.ts:457-490 (registration)Full registration of the 'track_device_variables' tool with MCP server, including schema, title, description, and inline handler function.server.registerTool('track_device_variables', { title: 'Track Device Variables', description: 'Track custom variables for a device', 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'), variables: z.record(z.string(), z.string()).refine(obj => Object.keys(obj).length > 0, 'At least one variable is required'), }, }, async ({ license_key, hardware_id, product, variables }) => { try { const response = await apiClient.post('/api/v4/track_device_variables', { license_key, hardware_id, product, variables, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2), }], }; } catch (error) { return { content: [{ type: 'text', text: `Error tracking device variables: ${handleApiError(error)}`, }], isError: true, }; } });
- src/types/index.ts:59-64 (schema)TypeScript interface defining the request shape for TrackDeviceVariablesRequest, matching the tool input.export interface TrackDeviceVariablesRequest { license_key: string; hardware_id: string; product: string; variables: Record<string, string>; }