Skip to main content
Glama
liveblocks
by liveblocks

get-active-users

Retrieve a list of active users in a Liveblocks room by specifying the room ID. Enables real-time monitoring of user activity within collaborative spaces.

Instructions

Get a Liveblocks room's active users

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
roomIdYes

Implementation Reference

  • The handler function for the 'get-active-users' tool. It takes a roomId, calls getLiveblocks().getActiveUsers via the callLiveblocksApi wrapper, passing the abort signal.
    async ({ roomId }, extra) => { return await callLiveblocksApi( getLiveblocks().getActiveUsers(roomId, { signal: extra.signal }) ); }
  • The input schema for the 'get-active-users' tool, requiring a single 'roomId' string parameter.
    { roomId: z.string(), },
  • src/server.ts:162-173 (registration)
    The registration of the 'get-active-users' tool using McpServer.tool, including name, description, schema, and handler.
    server.tool( "get-active-users", "Get a Liveblocks room's active users", { roomId: z.string(), }, async ({ roomId }, extra) => { return await callLiveblocksApi( getLiveblocks().getActiveUsers(roomId, { signal: extra.signal }) ); } );
  • Shared helper function callLiveblocksApi used by the handler to wrap Liveblocks API calls and format responses as MCP CallToolResult with JSON output or error messages.
    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