Skip to main content
Glama
by grab

join_channel

Join a designated channel to enable communication between the Talk to Figma MCP server and Figma, facilitating the exchange of design data and collaborative updates.

Instructions

Join a specific channel to communicate with Figma

Input Schema

NameRequiredDescriptionDefault
channelNoThe name of the channel to join

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "channel": { "default": "", "description": "The name of the channel to join", "type": "string" } }, "type": "object" }

Implementation Reference

  • MCP tool registration for 'join_channel', including inline schema (channel: z.string()) and handler function that validates input and calls joinChannel(channel).
    server.tool( "join_channel", "Join a specific channel to communicate with Figma", { channel: z.string().describe("The name of the channel to join").default(""), }, async ({ channel }: any) => { try { if (!channel) { // If no channel provided, ask the user for input return { content: [ { type: "text", text: "Please provide a channel name to join:", }, ], followUp: { tool: "join_channel", description: "Join the specified channel", }, }; } await joinChannel(channel); return { content: [ { type: "text", text: `Successfully joined channel: ${channel}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error joining channel: ${error instanceof Error ? error.message : String(error) }`, }, ], }; } } );
  • Handler function that sends the 'join' command via WebSocket to the socket server, updates the currentChannel state variable, with error handling and logging.
    async function joinChannel(channelName: string): Promise<void> { if (!ws || ws.readyState !== WebSocket.OPEN) { throw new Error("Not connected to Figma"); } try { await sendCommandToFigma("join", { channel: channelName }); currentChannel = channelName; logger.info(`Joined channel: ${channelName}`); } catch (error) { logger.error(`Failed to join channel: ${error instanceof Error ? error.message : String(error)}`); throw error; } }
  • WebSocket server-side logic for handling 'join' messages: creates channel if needed, adds client to channel Set, sends confirmation to client and notifications to other clients in channel.
    if (data.type === "join") { const channelName = data.channel; if (!channelName || typeof channelName !== "string") { ws.send(JSON.stringify({ type: "error", message: "Channel name is required" })); return; } // Create channel if it doesn't exist if (!channels.has(channelName)) { channels.set(channelName, new Set()); } // Add client to channel const channelClients = channels.get(channelName)!; channelClients.add(ws); console.log(`\n✓ Client joined channel "${channelName}" (${channelClients.size} total clients)`); // Notify client they joined successfully ws.send(JSON.stringify({ type: "system", message: `Joined channel: ${channelName}`, channel: channelName })); ws.send(JSON.stringify({ type: "system", message: { id: data.id, result: "Connected to channel: " + channelName, }, channel: channelName })); // Notify other clients in channel channelClients.forEach((client) => { if (client !== ws && client.readyState === WebSocket.OPEN) { client.send(JSON.stringify({ type: "system", message: "A new user has joined the channel", channel: channelName })); } }); return;

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/grab/cursor-talk-to-figma-mcp'

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