get-thread-participants
Retrieve a list of participants from a specific thread in a Liveblocks room using room and thread IDs. Streamline collaboration and communication tracking.
Instructions
Get a Liveblocks thread's participants
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| roomId | Yes | ||
| threadId | Yes |
Implementation Reference
- src/server.ts:303-310 (handler)The handler function that implements the core logic of the 'get-thread-participants' tool by invoking the Liveblocks SDK's getThreadParticipants method wrapped in utility functions.async ({ roomId, threadId }, extra) => { return await callLiveblocksApi( getLiveblocks().getThreadParticipants( { roomId, threadId }, { signal: extra.signal } ) ); }
- src/server.ts:299-302 (schema)Zod schema defining the input parameters for the tool: roomId and threadId as required strings.{ roomId: z.string(), threadId: z.string(), },
- src/server.ts:296-311 (registration)Registration of the 'get-thread-participants' tool on the McpServer instance, including description, schema, and handler.server.tool( "get-thread-participants", "Get a Liveblocks thread's participants", { roomId: z.string(), threadId: z.string(), }, async ({ roomId, threadId }, extra) => { return await callLiveblocksApi( getLiveblocks().getThreadParticipants( { roomId, threadId }, { signal: extra.signal } ) ); } );
- src/server.ts:21-28 (helper)Helper function to lazily initialize and provide the Liveblocks client instance used in 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 wraps Liveblocks API calls, formats successful responses as JSON in MCP format, and handles 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, }, ], }; } }