delete-thread
Remove a specific thread from a Liveblocks room to manage collaborative content and maintain organized workspaces.
Instructions
Delete a Liveblocks thread
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| roomId | Yes | ||
| threadId | Yes |
Implementation Reference
- src/server.ts:385-392 (handler)The handler function for the 'delete-thread' tool. It destructures roomId and threadId from input, then calls the Liveblocks SDK's deleteThread method wrapped in callLiveblocksApi to handle the API response formatting.async ({ roomId, threadId }, extra) => { return await callLiveblocksApi( getLiveblocks().deleteThread( { roomId, threadId }, { signal: extra.signal } ) ); }
- src/server.ts:381-384 (schema)Zod input schema for the 'delete-thread' tool, requiring roomId and threadId as strings.{ roomId: z.string(), threadId: z.string(), },
- src/server.ts:378-393 (registration)Registration of the 'delete-thread' tool on the McpServer instance, including name, description, schema, and handler.server.tool( "delete-thread", "Delete a Liveblocks thread", { roomId: z.string(), threadId: z.string(), }, async ({ roomId, threadId }, extra) => { return await callLiveblocksApi( getLiveblocks().deleteThread( { roomId, threadId }, { signal: extra.signal } ) ); } );
- src/server.ts:21-28 (helper)Helper function that lazily initializes and returns the Liveblocks Node.js SDK client used by the handler.function getLiveblocks() { if (!client) { client = new Liveblocks({ secret: process.env.LIVEBLOCKS_SECRET_KEY as string, }); } return client; }
- src/utils.ts:3-37 (helper)Helper function that wraps Liveblocks API promises, formatting successful responses as MCP CallToolResult with JSON and handling 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, }, ], }; } }