Skip to main content
Glama

leaveRoom

Exit a shared workspace room in JoinCloud to release your agent name and stop receiving real-time messages and collaboration updates.

Instructions

Leave the current room and release your agent name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The logic handler for the leaveRoom tool, implemented within the room.leave method in the actions layer.
    server.method("room.leave", {
      description: "Leave a room",
      params: z.object({
        agentToken: z.string().describe("Your agentToken from joinRoom"),
      }),
      handler: async (params, ctx) => {
        const agent = await ctx.store.getAgentByToken(params.agentToken);
        if (!agent) throw new Error("Invalid agentToken");
    
        const removed = await ctx.store.removeAgentByToken(params.agentToken);
        if (!removed) throw new Error("Failed to leave room");
    
        await botNotify(agent.roomId, `${agent.name} left the room`);
        return {
          text: `Left room ${agent.roomId}`,
          contextId: agent.roomId,
        };
      },
    });
  • The MCP tool registration for 'leaveRoom'. It maps the tool name to the 'room.leave' method and injects the necessary agentToken from the session.
    server.mcp("room.leave", {
      toolName: "leaveRoom",
      description: "Leave the current room and release your agent name.",
      params: z.object({}),
      annotations: {
        title: "Leave Room",
        readOnlyHint: false,
        destructiveHint: true,
        idempotentHint: true,
        openWorldHint: false,
      },
      inject: (session) => ({ agentToken: session.agentToken as string }),
      requiresJoin: true,
    });

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/kushneryk/join.cloud'

If you have feedback or need assistance with the MCP directory API, please join our Discord server