Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:8beeeaaat Touchdesigner mcp create node

From Leeroopedia
Knowledge Sources
Domains Node_Graph, CRUD
Last Updated 2026-10-28 22:13 GMT

Overview

Concrete tool for creating a new TouchDesigner operator node under a parent COMP, with initial parameter binding and automatic non-overlapping grid placement.

Description

The create_node method on `TouchDesignerApiService` resolves a parent COMP, calls `parent.create(node_type, node_name)`, applies optional initial parameter overrides (setting `par.val` or `setattr` for scalar attributes), delegates placement to `_align_new_node` (which calls `first_free_cell` from `node_layout.py`), and returns a full node summary. Parameter application and layout failures are logged but do not fail node creation.

Usage

Call this method when you need to:

  • Create a new node with automatic non-overlapping grid placement (default).
  • Create a node at an explicit position (supply `nodeX`/`nodeY` in `parameters` to skip auto-layout).
  • Create a node with initial parameters set at creation time.

This method is exposed as the `create_td_node` MCP tool. It is Step 1 of the Node Creation and Auto-Layout workflow.

Code Reference

Source Location

  • Repository: touchdesigner-mcp
  • File: td/modules/mcp/services/api_service.py
  • Lines: L351-393 (public method); `_align_new_node` at L395-420; `_get_node_summary` at L691-707

Signature

class TouchDesignerApiService:
    def create_node(
        self,
        parent_path: str,
        node_type: str,
        node_name: Optional[str] = None,
        parameters: Optional[dict[str, Any]] = None,
    ) -> Result:
        """Create a new node under the specified parent path.

        Args:
            parent_path: Path to the parent COMP.
            node_type: TD OP type (e.g. "textTOP", "noiseCHOP").
            node_name: Name for the new node (None lets TD auto-name).
            parameters: Initial param overrides; also read for nodeX/nodeY
                       to skip auto-layout.

        Returns:
            Result: success_result with {"result": {id, name, path, opType, properties{}}},
                    or error_result if parent not found or create fails.
        """

Import

from mcp.services.api_service import TouchDesignerApiService

I/O Contract

Inputs

Name Type Required Description
parent_path str Yes Path to the parent COMP (e.g. `/project1`)
node_type str Yes TD OP type (e.g. `textTOP`, `noiseCHOP`)
node_name Optional[str] No Name for the new node; None lets TD auto-name
parameters Optional[dict] No Initial param overrides; `nodeX`/`nodeY` skip auto-layout

Outputs

Name Type Description
result dict {id, name, path, opType, properties{}} — full node summary of the newly created node

Usage Examples

Create with Auto-Layout

from mcp.services.api_service import TouchDesignerApiService

service = TouchDesignerApiService()
result = service.create_node(
    parent_path="/project1",
    node_type="textTOP",
    node_name="my_text",
    parameters={"text": "Hello MCP"},
)
if result["success"]:
    node = result["data"]["result"]
    print(f"Created: {node['path']} ({node['opType']})")

Create with Explicit Position

# Supply nodeX/nodeY to skip auto-layout entirely
result = service.create_node(
    parent_path="/project1",
    node_type="noiseCHOP",
    node_name="my_noise",
    parameters={"nodeX": 200, "nodeY": -400},
)

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment