Skip to main content
Glama
liveblocks
by liveblocks

get-room

Retrieve a specific Liveblocks room using its unique room ID to enable real-time collaboration and data synchronization within the platform.

Instructions

Get a Liveblocks room

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
roomIdYes

Implementation Reference

  • src/server.ts:90-101 (registration)
    Full registration of the 'get-room' MCP tool, including inline input schema, description, and handler function that calls the Liveblocks SDK's getRoom method.
    server.tool( "get-room", "Get a Liveblocks room", { roomId: z.string(), }, async ({ roomId }, extra) => { return await callLiveblocksApi( getLiveblocks().getRoom(roomId, { signal: extra.signal }) ); } );
  • The handler function for 'get-room' which fetches the specified room using the Liveblocks client, passing the abort signal, and wraps the result with callLiveblocksApi.
    async ({ roomId }, extra) => { return await callLiveblocksApi( getLiveblocks().getRoom(roomId, { signal: extra.signal }) ); }
  • Input schema for 'get-room' tool: requires a 'roomId' string.
    { roomId: z.string(), },
  • Helper function to lazily initialize and return the Liveblocks client instance using the LIVEBLOCKS_SECRET_KEY environment variable.
    function getLiveblocks() { if (!client) { client = new Liveblocks({ secret: process.env.LIVEBLOCKS_SECRET_KEY as string, }); } return client; }
  • Shared helper utility that wraps Liveblocks API promise calls, formats successful responses as MCP CallToolResult with JSON stringified data, or error text on failure.
    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