Implementation:8beeeaaat Touchdesigner mcp get td python class details
| Knowledge Sources | |
|---|---|
| Domains | Introspection, API_Discovery |
| Last Updated | 2026-10-28 22:13 GMT |
Overview
Concrete tool for inspecting a specific TouchDesigner Python class or module, enumerating its methods and properties via `inspect.getmembers` with type classification.
Description
The get_td_python_class_details method on `TouchDesignerApiService` resolves a class name via `hasattr(td, class_name)` / `getattr(td, class_name)`, iterates over `inspect.getmembers(obj)`, classifies each member as a method (function/method/methoddescriptor) or property, and returns the class's name, type, description, methods list, and properties list. It is Step 2 of the Python API lookup ladder.
Usage
Call this method when you need to:
- Inspect a specific class's methods and properties after finding it via `get_td_python_classes`.
- Find the exact method or property name before writing a script.
- Understand the type classification of a class (class vs. module).
This method is exposed as the `get_td_class_details` MCP tool.
Code Reference
Source Location
- Repository: touchdesigner-mcp
- File: td/modules/mcp/services/api_service.py
- Lines: L77-127
Signature
class TouchDesignerApiService:
def get_td_python_class_details(self, class_name: str) -> Result:
"""Get detailed information about a specific Python class or module.
Args:
class_name: Attribute name on td (e.g. "textTOP", "noiseCHOP").
Resolved via hasattr(td, class_name).
Returns:
Result: success_result with {name, type, description, methods[], properties[]},
or error_result if class not found.
"""
Import
from mcp.services.api_service import TouchDesignerApiService
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| class_name | str | Yes | Attribute name on `td` (e.g. `textTOP`) |
Outputs
| Name | Type | Description |
|---|---|---|
| name | str | The class name |
| type | str | Type classification (kind for classes, type name for modules) |
| description | str | Class docstring |
| methods | list[dict] | Each entry: {name, description, type} |
| properties | list[dict] | Each entry: {name, description, type} |
Usage Examples
Inspect a Class
from mcp.services.api_service import TouchDesignerApiService
service = TouchDesignerApiService()
result = service.get_td_python_class_details("textTOP")
if result["success"]:
details = result["data"]
print(f"Class: {details['name']} ({details['type']})")
for m in details["methods"]:
print(f" method: {m['name']} — {m['description'][:60]}")
for p in details["properties"]:
print(f" prop: {p['name']}")