Skip to main content
Glama
bunkerapps

Superprecio MCP Server

by bunkerapps

subscribe_device

Register a device to receive price drop alerts, special deal notifications, and promotional messages from Superprecio's price comparison service.

Instructions

Subscribe a device to receive push notifications about deals and price alerts.

This tool registers a device token with the Superprecio notification system. Once subscribed, devices will receive:

  • Price drop alerts

  • Special deal notifications

  • New product announcements

  • Custom promotional messages

Note: Requires a valid Firebase Cloud Messaging device token.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceTokenYesFirebase Cloud Messaging device token

Implementation Reference

  • The main handler function that executes the subscribe_device tool logic. It validates arguments, calls the API client's subscribeDevice method, formats success/error responses.
    export async function executeSubscribeDevice(
      client: SuperPrecioApiClient,
      args: { deviceToken: string }
    ) {
      if (!args) {
        throw new Error('Missing required arguments');
      }
    
      const { deviceToken } = args;
    
      try {
        const result = await client.subscribeDevice(deviceToken);
    
        return {
          content: [
            {
              type: 'text',
              text: `Device subscribed successfully!\n\nYou will now receive notifications about:\n- Price drops\n- Special deals\n- New products\n- Promotional offers\n\nDevice Token: ${deviceToken.substring(0, 20)}...\n\nResult: ${JSON.stringify(result, null, 2)}`,
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Failed to subscribe device: ${error.message}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Tool definition including name, description, and input schema for validation.
    export const subscribeDeviceTool = {
      name: 'subscribe_device',
      description: `Subscribe a device to receive push notifications about deals and price alerts.
    
    This tool registers a device token with the Superprecio notification system.
    Once subscribed, devices will receive:
    - Price drop alerts
    - Special deal notifications
    - New product announcements
    - Custom promotional messages
    
    Note: Requires a valid Firebase Cloud Messaging device token.`,
      inputSchema: {
        type: 'object',
        properties: {
          deviceToken: {
            type: 'string',
            description: 'Firebase Cloud Messaging device token',
          },
        },
        required: ['deviceToken'],
      },
    };
  • src/index.ts:140-141 (registration)
    Registration in the tool execution switch statement in the MCP server.
    case 'subscribe_device':
      return await executeSubscribeDevice(apiClient, args as any);
  • src/index.ts:98-98 (registration)
    Inclusion of the tool in the listTools response.
    subscribeDeviceTool,
  • API client method that performs the actual HTTP POST to subscribe the device token.
    async subscribeDevice(token: string): Promise<any> {
      try {
        const response = await this.client.post('/devices/suscribe', { token });
        return response.data;
      } catch (error) {
        throw this.handleError(error);
      }
    }

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/bunkerapps/superprecio_mcp'

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