Skip to main content
Glama
liveblocks
by liveblocks

get-room

Retrieve a Liveblocks room to access real-time collaboration data and manage collaborative sessions by providing the room identifier.

Instructions

Get a Liveblocks room

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
roomIdYes

Implementation Reference

  • The core handler function for the 'get-room' tool. It takes roomId, calls getLiveblocks().getRoom via callLiveblocksApi utility.
    async ({ roomId }, extra) => { return await callLiveblocksApi( getLiveblocks().getRoom(roomId, { signal: extra.signal }) ); }
  • Zod input schema for the tool, requiring a 'roomId' string parameter.
    { roomId: z.string(), },
  • src/server.ts:90-101 (registration)
    Registration of the 'get-room' tool on the MCP server instance, specifying name, description, schema, and handler.
    server.tool( "get-room", "Get a Liveblocks room", { roomId: z.string(), }, async ({ roomId }, extra) => { return await callLiveblocksApi( getLiveblocks().getRoom(roomId, { signal: extra.signal }) ); } );
  • Helper function to lazily initialize and return the singleton Liveblocks server client.
    let client: Liveblocks; function getLiveblocks() { if (!client) { client = new Liveblocks({ secret: process.env.LIVEBLOCKS_SECRET_KEY as string, }); } return client; }
  • Utility function used by all tools to execute a Liveblocks API promise and format the result as MCP CallToolResult content (JSON or error).
    import { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; 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