get-inbox-notification
Retrieve specific inbox notifications by providing a userId and inboxNotificationId to monitor and manage updates within the Liveblocks system.
Instructions
Get a Liveblocks inbox notification
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inboxNotificationId | Yes | ||
| userId | Yes |
Implementation Reference
- src/server.ts:688-695 (handler)The handler function that implements the core logic of the 'get-inbox-notification' tool. It invokes the Liveblocks client's getInboxNotification method, wrapped by callLiveblocksApi, to fetch a specific inbox notification for the given user.async ({ userId, inboxNotificationId }, extra) => { return await callLiveblocksApi( getLiveblocks().getInboxNotification( { userId, inboxNotificationId }, { signal: extra.signal } ) ); }
- src/server.ts:681-696 (registration)Registration of the 'get-inbox-notification' tool using McpServer.tool(), including inline input schema and handler function.server.tool( "get-inbox-notification", "Get a Liveblocks inbox notification", { userId: z.string(), inboxNotificationId: z.string(), }, async ({ userId, inboxNotificationId }, extra) => { return await callLiveblocksApi( getLiveblocks().getInboxNotification( { userId, inboxNotificationId }, { signal: extra.signal } ) ); } );
- src/server.ts:684-687 (schema)Inline Zod schema defining the input parameters: userId (string) and inboxNotificationId (string).{ userId: z.string(), inboxNotificationId: z.string(), },
- src/server.ts:21-28 (helper)Helper function that lazily initializes and returns the Liveblocks Node.js client instance used by the tool handler.function getLiveblocks() { if (!client) { client = new Liveblocks({ secret: process.env.LIVEBLOCKS_SECRET_KEY as string, }); } return client; }
- src/utils.ts:3-37 (helper)Utility function that executes a Liveblocks API promise, formats the successful response with JSON stringification in MCP content format, or returns error text.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, }, ], }; } }