Skip to main content
Glama

leaveRoom

DestructiveIdempotent

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,
    });
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

While annotations declare destructiveHint=true, the description adds valuable behavioral context by specifying exactly what gets destroyed/released: 'your agent name'. This explains the specific side effect beyond the generic annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient 9-word sentence that front-loads the action. There is no redundancy or wasted text; every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity (no parameters) and presence of annotations covering safety profile, the description is nearly complete. It could benefit from noting error conditions (e.g., leaving when not in a room) or return value details, but covers the core operation adequately.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, establishing a baseline of 4. With no parameters to describe, the description appropriately focuses on the operation's effect rather than inventing parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Leave') with clear resource ('room') and adds the side effect ('release your agent name'). It clearly distinguishes from siblings like joinRoom, createRoom, and sendMessage by indicating this is an exit/disconnect action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'Leave the current room' implies this should be used when exiting a room, but there is no explicit when-to-use guidance, comparison to joinRoom, or mention of prerequisites (e.g., must be in a room first).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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