send-notification
Trigger push notifications to specific devices by sending a channel ID and content via the Pushinator API. Integrate into LLM workflows for real-time alerts.
Instructions
Send a notification via the Pushinator API
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | Yes | UUID of the channel to send the notification to | |
| content | Yes | String content of the notification |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"channel_id": {
"description": "UUID of the channel to send the notification to",
"type": "string"
},
"content": {
"description": "String content of the notification",
"type": "string"
}
},
"required": [
"channel_id",
"content"
],
"type": "object"
}
Implementation Reference
- src/index.ts:58-85 (handler)The handler function for the 'send-notification' tool. It makes a POST request to the Pushinator API to send a notification with the given channel_id and content, then returns the response message.async ({ channel_id, content }) => { const notificationUrl = `${PUSHINATOR_API_BASE}/notifications/send/`; const response = await fetch(notificationUrl, { method: "POST", headers: { "Content-Type": "application/json", "User-Agent": USER_AGENT, "Authorization": `Bearer ${process.env.PUSHINATOR_API_KEY}`, }, body: JSON.stringify({ channel_id, content, }), }); const responseData: PushinatorResponse = await response.json(); return { content: [ { type: "text", text: responseData.message, }, ], }; },
- src/index.ts:54-57 (schema)Zod input schema defining parameters for the 'send-notification' tool: channel_id (string UUID) and content (string).{ channel_id: z.string().describe("UUID of the channel to send the notification to"), content: z.string().describe("String content of the notification"), },
- src/index.ts:51-86 (registration)Registration of the 'send-notification' tool using server.tool(), specifying name, description, input schema, and handler function.server.tool( "send-notification", "Send a notification via the Pushinator API", { channel_id: z.string().describe("UUID of the channel to send the notification to"), content: z.string().describe("String content of the notification"), }, async ({ channel_id, content }) => { const notificationUrl = `${PUSHINATOR_API_BASE}/notifications/send/`; const response = await fetch(notificationUrl, { method: "POST", headers: { "Content-Type": "application/json", "User-Agent": USER_AGENT, "Authorization": `Bearer ${process.env.PUSHINATOR_API_KEY}`, }, body: JSON.stringify({ channel_id, content, }), }); const responseData: PushinatorResponse = await response.json(); return { content: [ { type: "text", text: responseData.message, }, ], }; }, );
- src/index.ts:8-11 (helper)TypeScript interface defining the expected response structure from the Pushinator API, used in the tool handler.interface PushinatorResponse { message: string; success: boolean; }