Skip to main content
Glama
liveblocks
by liveblocks

update-room

Modify access permissions and metadata for a Liveblocks room to control user and group access levels. Define public, read-only, or private settings for default, group, and user-specific access.

Instructions

Update a Liveblocks room

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
defaultAccessesYesThe default access permissions for the room. Permissions can be: 1. ["room:write"] // public 2. ["room:read", "room:presence:write"] // read-only 3. [] // private
groupsAccessesNo The group ID accesses for the room. Permissions can be: 1. ["room:write"] // public 2. ["room:read", "room:presence:write"] // read-only 3. [] // private For example, when setting a "design" group to have full/public access: { design: ["room:write"] } Setting to null is used to remove an existing access level: { design: null }
metadataNo
roomIdYes
usersAccessesNo The user ID accesses for the room. Permissions can be: 1. ["room:write"] // public 2. ["room:read", "room:presence:write"] // read-only 3. [] // private For example, when setting "charlie" user ID to have full/public access: { charlie: ["room:write"] } Setting to null is used to remove an existing access level: { charlie: null }

Implementation Reference

  • src/server.ts:103-130 (registration)
    Registration of the 'update-room' MCP tool, including inline input schema (using imported Zod types) and the handler function that invokes the Liveblocks SDK's updateRoom method via callLiveblocksApi.
    server.tool( "update-room", "Update a Liveblocks room", { roomId: z.string(), defaultAccesses: DefaultAccesses, groupsAccesses: GroupsAccesses.optional(), usersAccesses: UsersAccesses.optional(), metadata: z.record(z.string(), z.union([z.string(), z.null()])).optional(), }, async ( { roomId, defaultAccesses, groupsAccesses, usersAccesses, metadata }, extra ) => { return await callLiveblocksApi( getLiveblocks().updateRoom( roomId, { defaultAccesses: defaultAccesses as any, groupsAccesses: groupsAccesses as any, usersAccesses: usersAccesses as any, metadata, }, { signal: extra.signal } ) ); } );
  • The handler function for the 'update-room' tool. It destructures input parameters, calls getLiveblocks().updateRoom with the roomId and access/metadata updates, and wraps the result using callLiveblocksApi for MCP response formatting.
    async ( { roomId, defaultAccesses, groupsAccesses, usersAccesses, metadata }, extra ) => { return await callLiveblocksApi( getLiveblocks().updateRoom( roomId, { defaultAccesses: defaultAccesses as any, groupsAccesses: groupsAccesses as any, usersAccesses: usersAccesses as any, metadata, }, { signal: extra.signal } ) ); }
  • Zod schema definition for DefaultAccesses, used in the input schema of update-room tool.
    export const DefaultAccesses = z.array(z.string()).describe( `The default access permissions for the room. Permissions can be: 1. ["room:write"] // public 2. ["room:read", "room:presence:write"] // read-only 3. [] // private ` );
  • Zod schema definition for GroupsAccesses, used optionally in the input schema of update-room tool.
    export const GroupsAccesses = z .record(z.string(), z.array(z.union([z.string(), z.null()]))) .describe( ` The group ID accesses for the room. Permissions can be: 1. ["room:write"] // public 2. ["room:read", "room:presence:write"] // read-only 3. [] // private For example, when setting a "design" group to have full/public access: { design: ["room:write"] } Setting to null is used to remove an existing access level: { design: null } ` );
  • Zod schema definition for UsersAccesses, used optionally in the input schema of update-room tool.
    export const UsersAccesses = z.record( z.string(), z.array(z.union([z.string(), z.null()])) ).describe(` The user ID accesses for the room. Permissions can be: 1. ["room:write"] // public 2. ["room:read", "room:presence:write"] // read-only 3. [] // private For example, when setting "charlie" user ID to have full/public access: { charlie: ["room:write"] } Setting to null is used to remove an existing access level: { charlie: null } `);
  • Helper function callLiveblocksApi used by the update-room handler (and all tools) to handle API promises, format successful JSON responses, and catch errors for MCP tool results.
    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