Skip to main content
Glama
andreycretsu

Cursor Talk to Figma MCP

by andreycretsu

join_channel

Connect to a specific Figma channel for communication, enabling Cursor AI to read and modify designs programmatically through natural language commands.

Instructions

Join a specific channel to communicate with Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelNoThe name of the channel to join

Implementation Reference

  • MCP tool registration for 'join_channel' including inline handler and schema definition.
    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)
                  }`,
              },
            ],
          };
        }
      }
    );
  • The main handler function for the 'join_channel' tool. Validates input, calls joinChannel helper, and returns success/error response.
    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)
                }`,
            },
          ],
        };
      }
    }
  • Zod input schema for the tool, defining the 'channel' parameter.
    {
      channel: z.string().describe("The name of the channel to join").default(""),
    },
  • Helper function that sends the WebSocket 'join' message to the socket server (src/socket.ts) to join the specified channel.
    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;
      }
    }

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

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