get-notification-settings
Retrieve notification settings for a specific user in Liveblocks by providing their user ID. Simplify configuration management for real-time collaboration.
Instructions
Get a Liveblocks notification settings
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes |
Implementation Reference
- src/server.ts:758-772 (registration)Registration of the 'get-notification-settings' tool including inline input schema (userId: string) and handler function that calls the Liveblocks API to retrieve notification settings for a user.server.tool( "get-notification-settings", "Get a Liveblocks notification settings", { userId: z.string(), }, async ({ userId }, extra) => { return await callLiveblocksApi( getLiveblocks().getNotificationSettings( { userId }, { signal: extra.signal } ) ); } );
- src/server.ts:764-772 (handler)The handler function executes the tool logic by calling getLiveblocks().getNotificationSettings with the provided userId, wrapped in callLiveblocksApi.async ({ userId }, extra) => { return await callLiveblocksApi( getLiveblocks().getNotificationSettings( { userId }, { signal: extra.signal } ) ); } );
- src/server.ts:761-763 (schema)Input schema for the tool: requires a 'userId' string.{ userId: z.string(), },
- src/utils.ts:3-37 (helper)Helper function callLiveblocksApi used by the handler to wrap API calls, format responses as text with JSON, or handle errors.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, }, ], }; } }
- src/server.ts:21-28 (helper)Helper function getLiveblocks() that initializes and returns the Liveblocks client instance.function getLiveblocks() { if (!client) { client = new Liveblocks({ secret: process.env.LIVEBLOCKS_SECRET_KEY as string, }); } return client; }