join_channel
Connect to a Figma channel to enable real-time communication and collaboration within the CC Fig MCP server for design workflow integration.
Instructions
Join a specific channel to communicate with Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel | No | The name of the channel to join |
Implementation Reference
- The handler function for the 'join_channel' MCP tool. It validates the channel input, calls the joinChannel utility to join the WebSocket channel, and returns success or error messages.async ({ channel }) => { 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", }, }; } // Use joinChannel instead of sendCommandToFigma to ensure currentChannel is updated 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)}`, }, ], }; } }
- Zod input schema defining the 'channel' parameter for the join_channel tool.{ channel: z.string().describe("The name of the channel to join").default(""), },
- src/talk_to_figma_mcp/tools/document-tools.ts:278-325 (registration)Direct registration of the 'join_channel' tool using server.tool(), including schema and handler.// Join Channel Tool 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 }) => { 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", }, }; } // Use joinChannel instead of sendCommandToFigma to ensure currentChannel is updated 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)}`, }, ], }; } } );
- Helper function that sends the 'join' command to Figma WebSocket and updates the current channel state. Called by the tool handler.export 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; } }
- src/talk_to_figma_mcp/tools/index.ts:12-18 (registration)Top-level registration function that calls registerDocumentTools(server), which in turn registers the join_channel tool.export function registerTools(server: McpServer): void { registerDocumentTools(server); registerCreationTools(server); registerModificationTools(server); registerTextTools(server); registerComponentTools(server); }