Skip to main content
Glama
liveblocks
by liveblocks

edit-comment

Modify an existing comment within a Liveblocks room by specifying the room, thread, and comment IDs. Update the comment body, user ID, and edit timestamp to reflect changes.

Instructions

Edit a Liveblocks comment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commentIdYes
dataYes
roomIdYes
threadIdYes

Implementation Reference

  • The handler function for the 'edit-comment' tool. It calls the Liveblocks 'editComment' API method via 'callLiveblocksApi', passing roomId, threadId, commentId, and update data.
    async ({ roomId, threadId, commentId, data }, extra) => { return await callLiveblocksApi( getLiveblocks().editComment( { roomId, threadId, commentId, data }, { signal: extra.signal } ) ); }
  • Input schema validation for the 'edit-comment' tool using Zod. Includes roomId, threadId, commentId, and data object with body (CommentBody), userId, and optional editedAt.
    { roomId: z.string(), threadId: z.string(), commentId: z.string(), data: z.object({ body: CommentBody, userId: z.string(), editedAt: z.date().optional(), }), },
  • src/server.ts:492-513 (registration)
    Registration of the 'edit-comment' tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    server.tool( "edit-comment", `Edit a Liveblocks comment`, { roomId: z.string(), threadId: z.string(), commentId: z.string(), data: z.object({ body: CommentBody, userId: z.string(), editedAt: z.date().optional(), }), }, async ({ roomId, threadId, commentId, data }, extra) => { return await callLiveblocksApi( getLiveblocks().editComment( { roomId, threadId, commentId, data }, { signal: extra.signal } ) ); } );
  • Zod schema for CommentBody, which defines the rich text structure (versioned paragraphs with inline text, mentions, links) used in the 'edit-comment' tool input.
    export const CommentBody = z.object({ version: z.literal(1), content: z.array(CommentBodyParagraph), });
  • Helper utility 'callLiveblocksApi' used by the handler to execute Liveblocks API calls and format the response as MCP tool result (JSON stringified content or error).
    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, }, ], }; } }

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