> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: "updateXmlForNode"
sidebarTitle: "updateXmlForNode"
description: "Update the XML for a node using its nodeId and passing a new XML string. It can be used to update nodes text or attributes, reorder nodes in the XML tree, or create new nodes. IMPORTANT: Call getProje"
tag: "TOOL"
tagColor: "purple"
gridGap: 30
---

<Aside full>
  <RequestExample>
    ```json lines=false
    {
      "method": "tools/call",
      "params": {
        "name": "updateXmlForNode",
        "arguments": {
          "nodeId": "string",
          "xml": "string",
          "zoomIntoView": true
        }
      }
    }
    ```
  </RequestExample>
</Aside>

<MCPTool {...{"name":"updateXmlForNode","description":"Update the XML for a node using its nodeId and passing a new XML string. It can be used to update nodes text or attributes, reorder nodes in the XML tree, or create new nodes.\n\nIMPORTANT: Call getProjectXml first to see available node attributes, pre-built section components, and project structure.\n\n## Node Creation\n\nNodes without a nodeId attribute will be created as new nodes. To create a new node, simply omit the nodeId attribute. The node type is determined by the content and attributes:\n- Nodes with layout attributes (layout=\"stack\" or layout=\"grid\") become Frame nodes\n- Nodes with svg attribute become SVG nodes\n- Nodes with componentId or insertUrl attributes become ComponentInstance nodes. This is the PREFERRED way to insert components with full attribute support in one step. Get the insertUrl using getComponentInsertUrlAndTypes first.\n  - **Linked components** (default): Use insertUrl as-is to create a linked component instance that updates when the source component changes\n  - **Detached components**: Add ?detached=true query parameter to insertUrl (e.g., insertUrl=\"https://framer.com/m/Button.js?detached=true\") to create detached/unlinked layers. The component's internal structure becomes editable regular nodes (Frame, Text, etc.) that won't update with the source. IMPORTANT: After creating a detached component, you MUST call getNodeXml on the parent node again to see the actual internal structure that was created, as it will contain multiple child nodes (Text, Frame, SVG, etc.) from the component's definition.\n- Nodes with text content become Text nodes. To add a text node you must create a new wrapping element too and omit its nodeId, you CANNOT add text to an existing element that does not already contain text\n\nThe tag name of new nodes will be used for the new node title in Framer, it has no semantic meaning\n\nWhen creating a new node ALWAYS mention the node before and after it so that it can be put in the right place. Also ALWAYS wrap it with a known nodeId wrapper node (usually the same nodeId used in the tool params).\n\nThe tool output will contain the newly created node ids, in following calls you MUST use those nodeIds to reference the newly created nodes.\n\nIMPORTANT! You cannot add text content to an existing element with an existing nodeId it if does not already contain text! Instead put the new text inside a wrapper Text element\n\n## Node Updates\n\nIf a node id changes its parent, it will be moved in the tree.\n\nDo not pass a string too large in this tool, instead call this tool multiple times and pass only the nodes you want to update, omit attributes or nodes that you don't need to update.\n\nCall this tool multiple times instead of batching all the updates in one tool call. This way the user will be able to see your changes in real-time in the Framer canvas.\n\nThis tool is generally called using a component or page nodeId and passing a portion of the XML tree. To delete nodes you should use deleteNode instead. If a node is omitted it will not be deleted.\n\nYou can pass a partial a XML string, there is no need to include the full XML structure, missing nodes will be ignored. You can also omit attributes, omitted attributes will be ignored.\n\n## Capabilities\n\nYou can use this tool to:\n- Create new nodes by omitting nodeId attribute (Frame, Text, SVG, ComponentInstance)\n- Insert components as linked instances or detached layers (use insertUrl with optional ?detached=true)\n- Update text content for one or multiple nodes\n- Update attributes of existing nodes\n- Reorder nodes in the tree by changing their parent or position\n- Create wrapper layers by placing existing nodes inside new nodes\n\nFor adding sections (hero, pricing, footer, etc.), see the Pre-built Section Components documentation in getProjectXml output.\n\nThis tool CANNOT be used for:\n- Code files (use 'updateCodeFile' instead)\n- Color styles (use 'manageColorStyle' with type: 'update' instead)\n- Text styles (use 'manageTextStyle' with type: 'update' instead)\n- Deleting nodes (use 'deleteNode' instead)\n\n## Return Value\n\nReturns a summary of changes made, followed by a diff patch showing the XML changes in unified diff format.\n","inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"nodeId":{"type":"string","minLength":1,"description":"The ID of the node to update"},"xml":{"type":"string","minLength":1,"description":"XML string containing the updates. Can include multiple nodes with their nodeId attributes"},"zoomIntoView":{"description":"Whether to zoom into the node before making updates in Framer. Set to true to see where updates will happen (default), false to run updates in background. Do not ask user about this setting - default to true and mention they can disable zooming if they want to use Framer app while MCP is working.","type":"boolean"}},"required":["nodeId","xml"],"additionalProperties":false},"annotations":{"idempotentHint":true}}} />
