Skip to main content
The get_selection tool reads the current editor selection and returns the IDs of all selected components. This creates a direct collaboration channel between you and your agent: you select the element you want the agent to work on, then your agent calls get_selection to discover your intent without needing you to type out a component ID manually. This is particularly useful in interactive workflows where you want the agent to apply changes to whichever element you’re focused on in the editor — whether that’s a single button, a navigation bar, or a multi-selected group of cards.

Parameters

get_selection takes no parameters. Pass an empty object as arguments.

Response

string[]
required
An array of component ID strings for all currently selected components. Returns an empty array ([]) if nothing is selected in the editor.

Example

Build agent prompts around selection. For example: “Select a component in the canvas, then ask your agent to change its background color.” The agent calls get_selection to get the ID, then calls update_styles with that ID — no manual ID lookup required.
If multiple components are selected in the editor, all of their IDs are returned in the array. You can pass this entire array to delete_nodes to remove them all at once.