Skip to main content
Glama
stier1ba

LicenseSpring MCP Server

by stier1ba

get_trial_key

Generate trial license keys for specific products using hardware ID inputs within the LicenseSpring MCP Server for streamlined licensing management.

Instructions

Generate a trial license key for a product

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hardware_idYes
productYes

Implementation Reference

  • Registration of the 'get_trial_key' tool, including inline schema and handler function that proxies to the LicenseSpring API /api/v4/trial_key endpoint.
    server.registerTool('get_trial_key', {
      title: 'Get Trial Key',
      description: 'Generate a trial license key for a product',
      inputSchema: {
        hardware_id: z.string().min(1, 'Hardware ID is required'),
        product: z.string().min(1, 'Product code is required'),
      },
    }, async ({ hardware_id, product }) => {
      try {
        const queryParams = new URLSearchParams({
          hardware_id,
          product,
        });
        const response = await apiClient.get(`/api/v4/trial_key?${queryParams}`);
        
        return {
          content: [{
            type: 'text',
            text: JSON.stringify(response.data, null, 2),
          }],
        };
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: `Error generating trial key: ${handleApiError(error)}`,
          }],
          isError: true,
        };
      }
    });
  • The handler function for 'get_trial_key' which constructs a query with hardware_id and product, calls the LicenseSpring API, and returns the response or formatted error.
    }, async ({ hardware_id, product }) => {
      try {
        const queryParams = new URLSearchParams({
          hardware_id,
          product,
        });
        const response = await apiClient.get(`/api/v4/trial_key?${queryParams}`);
        
        return {
          content: [{
            type: 'text',
            text: JSON.stringify(response.data, null, 2),
          }],
        };
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: `Error generating trial key: ${handleApiError(error)}`,
          }],
          isError: true,
        };
      }
    });
  • Input schema validation using Zod for required hardware_id and product strings.
    inputSchema: {
      hardware_id: z.string().min(1, 'Hardware ID is required'),
      product: z.string().min(1, 'Product code is required'),
    },

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