Skip to main content
Glama
liveblocks

Liveblocks

Official
by liveblocks

trigger-inbox-notification

Send custom notifications to user inboxes in Liveblocks applications. Specify user, notification type, subject, and custom data to deliver targeted alerts.

Instructions

Create a custom Liveblocks inbox notification

Input Schema

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

Implementation Reference

  • src/server.ts:698-723 (registration)
    Registration of the 'trigger-inbox-notification' MCP tool using McpServer.tool method, including inline schema and handler function.
    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 }
          )
        );
      }
    );
  • The handler function that executes the tool logic by calling the Liveblocks SDK's triggerInboxNotification via the callLiveblocksApi utility.
    async ({ userId, kind, subjectId, activityData, roomId }, extra) => {
      return await callLiveblocksApi(
        getLiveblocks().triggerInboxNotification(
          { userId, kind: kind as `$${string}`, subjectId, activityData, roomId },
          { signal: extra.signal }
        )
      );
    }
  • Inline Zod schema defining the input parameters for the 'trigger-inbox-notification' tool: userId, kind (custom starting with $), subjectId, activityData, and optional roomId.
      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"),
    },

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