Skip to main content
Glama
bunkerapps

Superprecio MCP Server

by bunkerapps

send_notification

Send push notifications to specific devices or broadcast alerts to all users for price drops, deals, and important updates using Firebase Cloud Messaging.

Instructions

Send a push notification to a specific device or broadcast to all subscribed devices.

This tool can:

  • Send personalized notifications to specific devices

  • Broadcast alerts to all users

  • Include custom data (like product links, images, etc.)

  • Notify about price drops, deals, or important updates

Note: Requires Firebase Cloud Messaging setup on the Superprecio server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesNotification title
messageYesNotification body/message
deviceTokenNoOptional: specific device token to send to. If not provided, broadcasts to all devices.
dataNoOptional: additional data to include (e.g., product URL, image URL)

Implementation Reference

  • Core handler function that implements the send_notification tool logic. Handles input validation, conditional API calls for targeted or broadcast notifications, response formatting, and error handling.
    export async function executeSendNotification( client: SuperPrecioApiClient, args: { title: string; message: string; deviceToken?: string; data?: Record<string, any>; } ) { if (!args) { throw new Error('Missing required arguments'); } const { title, message, deviceToken, data } = args; try { let result; if (deviceToken) { // Send to specific device result = await client.sendNotification({ token: deviceToken, title, body: message, data, }); return { content: [ { type: 'text', text: `Notification sent successfully to device!\n\nTitle: ${title}\nMessage: ${message}`, }, ], }; } else { // Broadcast to all devices result = await client.broadcastNotification({ title, body: message, data, }); return { content: [ { type: 'text', text: `Notification broadcast successfully to all devices!\n\nTitle: ${title}\nMessage: ${message}\n\nResult: ${JSON.stringify(result, null, 2)}`, }, ], }; } } catch (error: any) { return { content: [ { type: 'text', text: `Failed to send notification: ${error.message}`, }, ], isError: true, }; } }
  • Defines the tool metadata, description, and input schema for validation of send_notification parameters.
    export const sendNotificationTool = { name: 'send_notification', description: `Send a push notification to a specific device or broadcast to all subscribed devices. This tool can: - Send personalized notifications to specific devices - Broadcast alerts to all users - Include custom data (like product links, images, etc.) - Notify about price drops, deals, or important updates Note: Requires Firebase Cloud Messaging setup on the Superprecio server.`, inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'Notification title', }, message: { type: 'string', description: 'Notification body/message', }, deviceToken: { type: 'string', description: 'Optional: specific device token to send to. If not provided, broadcasts to all devices.', }, data: { type: 'object', description: 'Optional: additional data to include (e.g., product URL, image URL)', }, }, required: ['title', 'message'], }, };
  • src/index.ts:97-97 (registration)
    Registration of sendNotificationTool in the array of tools returned by the MCP listTools handler.
    sendNotificationTool,
  • src/index.ts:137-138 (registration)
    Dispatch/execution routing for the send_notification tool in the MCP callTool request handler.
    case 'send_notification': return await executeSendNotification(apiClient, args as any);
  • Underlying API client method for sending notifications to a specific device token, called by the tool handler.
    async sendNotification(data: { token: string; title: string; body: string; data?: Record<string, any>; }): Promise<any> { try { const response = await this.client.post('/notifications/send', data); 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