send_notification
Deliver weather alerts and updates directly to macOS users through native system notifications, providing timely information on temperature, conditions, humidity, wind speed, and atmospheric pressure.
Instructions
Send a macOS notification with provided weather data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Notification message | |
| title | Yes | Notification title |
Implementation Reference
- index.js:115-145 (handler)The main handler function for the send_notification tool. It executes an AppleScript via child_process to display a macOS notification dialog with the provided title and message, handling success and error responses.async sendNotification(title, message) { try { const { exec } = await import('child_process'); const { promisify } = await import('util'); const execAsync = promisify(exec); const combinedMessage = `${title}\\n\\n${message}`; const script = `osascript -e 'tell application "System Events" to display dialog "${combinedMessage}" with title "Weather Update" buttons {"OK"} default button "OK" giving up after 10'`; console.error("Executing:", script); await execAsync(script); return { content: [ { type: "text", text: `✅ Weather dialog displayed!\nTitle: ${title}\nMessage: ${message}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `❌ Failed: ${error.message}`, }, ], }; } }
- index.js:48-65 (registration)Registration of the send_notification tool in the ListToolsRequestSchema handler, including name, description, and input schema.{ name: "send_notification", description: "Send a macOS notification with provided weather data", inputSchema: { type: "object", properties: { title: { type: "string", description: "Notification title", }, message: { type: "string", description: "Notification message", }, }, required: ["title", "message"], }, },
- index.js:77-79 (handler)Dispatch handler in CallToolRequestSchema that routes calls to the send_notification tool by invoking the sendNotification method.if (name === "send_notification") { return await this.sendNotification(args.title, args.message); }
- index.js:51-64 (schema)Input schema definition for the send_notification tool, specifying title and message as required strings.inputSchema: { type: "object", properties: { title: { type: "string", description: "Notification title", }, message: { type: "string", description: "Notification message", }, }, required: ["title", "message"], },