Skip to main content
Glama
notification.ts3.29 kB
import { z } from 'zod'; import { createHandler } from '../../utils/client.js'; import { registry } from '../../utils/registry.js'; import { CommandHandler } from '../../utils/registry.js'; const namespace = 'notification'; // Push message const pushMsgHandler: CommandHandler = { namespace, name: 'pushMsg', description: 'Push a message notification', params: z.object({ msg: z.string().describe('Message content'), timeout: z.number().optional().describe('Message display duration in milliseconds') }), handler: createHandler('/api/notification/pushMsg'), documentation: { description: 'Push a message notification', params: { msg: { type: 'string', description: 'Message content', required: true }, timeout: { type: 'number', description: 'Message display duration in milliseconds', required: false } }, returns: { type: 'object', description: 'Operation result', properties: {} }, examples: [ { description: 'This example shows how to display a temporary notification message to the user for 7 seconds, useful for showing operation success or status updates.', params: { msg: "Hello World", timeout: 7000 }, response: {} } ], apiLink: 'https://github.com/siyuan-note/siyuan/blob/master/API.md#push-message' } }; // Push error message const pushErrMsgHandler: CommandHandler = { namespace, name: 'pushErrMsg', description: 'Push an error message notification', params: z.object({ msg: z.string().describe('Error message content'), timeout: z.number().optional().describe('Message display duration in milliseconds') }), handler: createHandler('/api/notification/pushErrMsg'), documentation: { description: 'Push an error message notification', params: { msg: { type: 'string', description: 'Error message content', required: true }, timeout: { type: 'number', description: 'Message display duration in milliseconds', required: false } }, returns: { type: 'object', description: 'Operation result', properties: {} }, examples: [ { description: 'This example demonstrates displaying an error notification that persists for 7 seconds, highlighting a failed operation or system issue to the user.', params: { msg: "Operation failed", timeout: 7000 }, response: {} } ], apiLink: 'https://github.com/siyuan-note/siyuan/blob/master/API.md#push-error-message' } }; // Register all notification related commands export function registerNotificationHandlers() { registry.registerCommand(pushMsgHandler); registry.registerCommand(pushErrMsgHandler); }

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/onigeya/siyuan-mcp-server'

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