Skip to main content

Overview

Focuses the Figma viewport on a specific node by selecting it and scrolling the canvas to bring it into view. This is useful for directing user attention to a specific element or navigating to a node programmatically.

Parameters

nodeId
string
required
The ID of the node to focus on. The node must exist in the current document.

Return Value

Returns confirmation with the focused node’s name and ID:
{
  "name": "Button Component",
  "id": "123:456"
}

Usage Example

const result = await use_mcp_tool({
  server_name: "TalkToFigma",
  tool_name: "set_focus",
  arguments: {
    nodeId: "123:456"
  }
});

console.log(`Focused on: ${result.name}`);

Behavior

When you call set_focus:
  1. The node is selected (previous selection is replaced)
  2. The viewport scrolls to center the node
  3. The node becomes visible and highlighted

Best Practices

Use set_focus to guide users to specific elements during automated workflows or after creating/modifying nodes.
Calling set_focus will replace the current selection. If you need to preserve the selection, use get_selection first to save it.

Common Use Cases

  • Navigating to a newly created element
  • Highlighting errors or issues in designs
  • Guiding users through a review process
  • Showing results of search operations
  • Demonstrating design changes

Code Location

Source: server.ts:2462-2491

Build docs developers (and LLMs) love