Skip to main content
Glama

Superprecio MCP Server

by bunkerapps
sendNotification.ts2.54 kB
/** * MCP Tool: Send Notification * Send push notifications to subscribed devices */ import type { SuperPrecioApiClient } from '../client/superPrecioApi.js'; 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'], }, }; export async function executeSendNotification( client: SuperPrecioApiClient, args: { title: string; message: string; deviceToken?: string; data?: Record<string, any>; } ) { 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, }; } }

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