Skip to main content

Figma

Give agents tools to read files, versions, components, and styles, render images, manage comments and dev resources, and read and update variables in Figma through Mastra Connect. Each tool call goes through the Mastra platform, which adds the connection's credential. Your application never stores Figma credentials.

Connect
Direct link to Connect

Before you start, complete the Connect setup to install @mastra/connect and configure your platform project.

note

Figma only lets full members of Enterprise organizations use the variable tools, and updating variables also needs edit access to the file. On other plans, Figma refuses those calls. Node IDs work in either the 1:2 form the API uses or the 1-2 form in Figma URLs. The toolset can't list a team's projects or files, so give the agent a file key or file URL.

Connect an account
Direct link to Connect an account

Run this command from the directory that contains your .env file:

mastra connect add figma

The CLI guides you through Figma's authorization and waits until the connection is active.

Add tools to an agent
Direct link to Add tools to an agent

Pass tools() to the agent and select the figma provider:

src/mastra/agents/figma-agent.ts
import { Agent } from '@mastra/core/agent'
import { tools } from '@mastra/connect'

export const figmaAgent = new Agent({
id: 'figma-agent',
name: 'Figma agent',
instructions:
'You help people read files, versions, components, and styles, render images, manage comments and dev resources, and read and update variables in Figma.',
model: 'openai/gpt-6-luna',
tools: tools({ providers: ['figma'] }),
})

The agent gets 29 Figma tools, with keys such as figma_create_comment. See Figma tools for the full list, and the tools() parameters to restrict tools or require approval before a call runs.

On this page