Skip to main content
Glama
liveblocks

Liveblocks

Official
by liveblocks

create-thread

Create collaborative comment threads in real-time rooms for team discussions and feedback.

Instructions

Create a Liveblocks thread. Always ask for a userId.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
roomIdYes
dataYes

Implementation Reference

  • The handler function that executes the 'create-thread' tool logic by proxying to the Liveblocks createThread API wrapped in callLiveblocksApi.
    async ({ roomId, data }, extra) => {
      return await callLiveblocksApi(
        getLiveblocks().createThread({ roomId, data }, { signal: extra.signal })
      );
    }
  • Input schema for the 'create-thread' tool, defining parameters roomId and data (with comment body, userId, and optional metadata). Uses CommentBody from zod.ts.
    {
      roomId: z.string(),
      data: z.object({
        comment: z.object({
          body: CommentBody,
          userId: z.string(),
          createdAt: z.date().optional(),
        }),
        metadata: z
          .record(z.string(), z.union([z.string(), z.boolean(), z.number()]))
          .optional(),
      }),
    },
  • src/server.ts:259-280 (registration)
    Registration of the 'create-thread' tool on the MCP server, including name, description, input schema, and inline handler function.
    server.tool(
      "create-thread",
      `Create a Liveblocks thread. Always ask for a userId.`,
      {
        roomId: z.string(),
        data: z.object({
          comment: z.object({
            body: CommentBody,
            userId: z.string(),
            createdAt: z.date().optional(),
          }),
          metadata: z
            .record(z.string(), z.union([z.string(), z.boolean(), z.number()]))
            .optional(),
        }),
      },
      async ({ roomId, data }, extra) => {
        return await callLiveblocksApi(
          getLiveblocks().createThread({ roomId, data }, { signal: extra.signal })
        );
      }
    );

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