Skip to main content
Glama
liveblocks

Liveblocks

Official
by liveblocks

get-comment

Retrieve specific comments from Liveblocks collaborative rooms using room, thread, and comment identifiers for real-time collaboration management.

Instructions

Get a Liveblocks comment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
roomIdYes
threadIdYes
commentIdYes

Implementation Reference

  • src/server.ts:474-490 (registration)
    Registration of the 'get-comment' MCP tool, including schema and handler function.
    server.tool(
      "get-comment",
      `Get a Liveblocks comment`,
      {
        roomId: z.string(),
        threadId: z.string(),
        commentId: z.string(),
      },
      async ({ roomId, threadId, commentId }, extra) => {
        return await callLiveblocksApi(
          getLiveblocks().getComment(
            { roomId, threadId, commentId },
            { signal: extra.signal }
          )
        );
      }
    );
  • Handler function that fetches the specified comment from Liveblocks API using getLiveblocks().getComment and formats the response.
    async ({ roomId, threadId, commentId }, extra) => {
      return await callLiveblocksApi(
        getLiveblocks().getComment(
          { roomId, threadId, commentId },
          { signal: extra.signal }
        )
      );
    }
  • Zod input schema defining parameters: roomId, threadId, and commentId as strings.
    {
      roomId: z.string(),
      threadId: z.string(),
      commentId: z.string(),
    },
  • Helper function callLiveblocksApi used by the handler to wrap Liveblocks API calls and format MCP responses.
    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