Skip to main content
Glama
liveblocks
by liveblocks

trigger-inbox-notification

Send targeted notifications to users within Liveblocks by specifying custom activity data, user ID, and subject for enhanced real-time collaboration alerts.

Instructions

Create a custom Liveblocks inbox notification

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
activityDataYesCustom data related to the notification
kindYes
roomIdNoDon't add this unless specifically asked
subjectIdYes
userIdYes

Implementation Reference

  • The handler function that executes the tool logic by calling the Liveblocks API to trigger a custom inbox notification.
    async ({ userId, kind, subjectId, activityData, roomId }, extra) => { return await callLiveblocksApi( getLiveblocks().triggerInboxNotification( { userId, kind: kind as `$${string}`, subjectId, activityData, roomId }, { signal: extra.signal } ) ); }
  • Zod input schema defining parameters for the trigger-inbox-notification tool.
    userId: z.string(), kind: z.string().regex(/^\$/, { message: "String must start with '$'", }), subjectId: z.string(), activityData: z .record(z.string(), z.union([z.string(), z.boolean(), z.number()])) .describe("Custom data related to the notification"), roomId: z .string() .optional() .describe("Don't add this unless specifically asked"), },
  • src/server.ts:698-723 (registration)
    Registration of the trigger-inbox-notification tool using McpServer.tool().
    server.tool( "trigger-inbox-notification", "Create a custom Liveblocks inbox notification", { userId: z.string(), kind: z.string().regex(/^\$/, { message: "String must start with '$'", }), subjectId: z.string(), activityData: z .record(z.string(), z.union([z.string(), z.boolean(), z.number()])) .describe("Custom data related to the notification"), roomId: z .string() .optional() .describe("Don't add this unless specifically asked"), }, async ({ userId, kind, subjectId, activityData, roomId }, extra) => { return await callLiveblocksApi( getLiveblocks().triggerInboxNotification( { userId, kind: kind as `$${string}`, subjectId, activityData, roomId }, { signal: extra.signal } ) ); } );
  • Supporting utility function used by the handler to format the Liveblocks API response as MCP CallToolResult.
    export async function callLiveblocksApi( liveblocksPromise: Promise<any> ): Promise<CallToolResult> { try { const data = await liveblocksPromise; if (!data) { return { content: [{ type: "text", text: "Success. No data returned." }], }; } return { content: [ { type: "text", text: "Here is the data. If the user has no specific questions, return it in a JSON code block", }, { type: "text", text: JSON.stringify(data, null, 2), }, ], }; } catch (err) { return { content: [ { type: "text", text: "" + err, }, ], }; } }

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

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