join_channel
Connect to a specific Figma channel to communicate and interact with design elements using natural language commands through Cursor AI.
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
- src/talk_to_figma_mcp/server.ts:946-983 (handler)Main handler function for the 'join_channel' MCP tool. Handles input validation, prompts for channel if missing, calls joinChannel helper, and formats success/error responses.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" } }; } 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 performs the actual channel joining by sending a 'join' command via WebSocket to Figma and updates the current channel state.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; console.info(`Joined channel: ${channelName}`); } catch (error) { console.error(`Failed to join channel: ${error instanceof Error ? error.message : String(error)}`); throw error; } }
- Zod schema defining the input parameter 'channel' for the join_channel tool.{ channel: z.string().describe("The name of the channel to join").default("") },
- src/talk_to_figma_mcp/server.ts:940-984 (registration)Registration of the 'join_channel' tool on the MCP server, including name, description, schema, and handler reference.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" } }; } 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)}` } ] }; } } );