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 get node errors

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

Overview

Concrete tool for collecting error and warning messages from a TouchDesigner node and all its descendants, with anchor attribution and stream-completeness tracking.

Description

The get_node_errors method on `TouchDesignerApiService` reads both the `errors()` and `warnings()` streams of a node (with `recurse=True` so descendants are included), parses each message into structured entries, resolves anchor strings to the originating descendant, and returns a `TdNodeErrorReport`-shaped dict. It is the most carefully-reasoned method in the API service because of the "no errors ≠ healthy" property: a Script OP callback exception reaches neither stream.

Usage

Call this method when you need to:

  • Diagnose errors and warnings on a node and its descendants before applying a fix.
  • Re-check the error report after a fix to confirm counts dropped.
  • Build a "health check" that surfaces problems a user may not know exist.

This method is exposed as the `get_td_node_errors` MCP tool.

Code Reference

Source Location

  • Repository: touchdesigner-mcp
  • File: td/modules/mcp/services/api_service.py
  • Lines: L171-311 (public method); helpers `_parse_op_messages`, `_classify_anchor` in the same file

Signature

class TouchDesignerApiService:
    def get_node_errors(self, node_path: str) -> Result:
        """Collect error and warning messages for a node and all its descendants.

        Args:
            node_path: Absolute TD operator path (e.g. /project1/text1).
                      recurse=True is forced internally so descendants are included.

        Returns:
            Result: success_result with TdNodeErrorReport-shaped dict, or error_result.
        """

Import

from mcp.services.api_service import TouchDesignerApiService

I/O Contract

Inputs

Name Type Required Description
node_path str Yes Absolute TD operator path (e.g. `/project1/text1`)

Outputs

Name Type Description
nodePath str The queried path
nodeName str Display name of the queried node
opType str Operator type of the queried node
errorCount int Number of parsed error entries
warningCount int Number of parsed warning entries
hasErrors bool True if errorCount > 0
hasWarnings bool True if warningCount > 0
incomplete bool True if any stream was skipped (unavailable, None, or raised)
skippedStreams list[dict] Each entry: {stream, reason}
unresolvedAnchors list Anchors that could not be resolved to a descendant
lookupFailures list Anchor paths that no longer exist
fallbackAttributions list Messages attributed to the queried node (no anchor present)
errors list[dict] Parsed error entries
warnings list[dict] Parsed warning entries

Usage Examples

Basic Error Report

from mcp.services.api_service import TouchDesignerApiService

service = TouchDesignerApiService()
result = service.get_node_errors("/project1/text1")

if result["success"]:
    report = result["data"]
    print(f"Errors: {report['errorCount']}, Warnings: {report['warningCount']}")
    if report["incomplete"]:
        print(f"Skipped streams: {report['skippedStreams']}")
    for entry in report["errors"]:
        print(f"  ERROR [{entry.get('anchor', '?')}]: {entry.get('message', '')}")
else:
    print(f"Lookup failed: {result['error']}")

Re-check After Fix

# Step 1: capture the before-fix report
before = service.get_node_errors("/project1/text1")
before_errors = before["data"]["errorCount"] if before["success"] else -1

# ... apply the fix (exec_node_method or exec_python_script) ...

# Step 4: capture the after-fix report and compare
after = service.get_node_errors("/project1/text1")
after_errors = after["data"]["errorCount"] if after["success"] else -1

if after_errors < before_errors:
    print(f"Fix reduced errors: {before_errors} -> {after_errors}")
else:
    print("Fix did not reduce error count")

Related Pages

Implements Principle

Requires Environment

Page Connections

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