Implementation:8beeeaaat Touchdesigner mcp get module help
| Knowledge Sources | |
|---|---|
| Domains | Introspection, API_Discovery |
| Last Updated | 2026-10-28 22:13 GMT |
Overview
Concrete tool for rendering Python `help()` documentation for a TouchDesigner module or class, resolving dotted names and stripping terminal control sequences from `pydoc.render_doc` output.
Description
The get_module_help method on `TouchDesignerApiService` resolves a module or class name (supporting dotted names like `td.noiseCHOP` or `td.tdu.SomeClass`) via the `_resolve_help_target` helper, renders the documentation with `pydoc.render_doc(target)`, strips backspace control sequences via `_normalize_help_text`, and returns the cleaned help text. It is Step 3 of the Python API lookup ladder.
Usage
Call this method when you need to:
- Read the official documentation for a TD Python module or class.
- Understand parameter descriptions, return types, and usage examples.
- Verify the documentation before writing a script that uses the API.
This method is exposed as the `get_td_module_help` MCP tool.
Code Reference
Source Location
- Repository: touchdesigner-mcp
- File: td/modules/mcp/services/api_service.py
- Lines: L129-154 (public method); helpers `_resolve_help_target` at L709-758, `_normalize_help_text` at L773-791
Signature
class TouchDesignerApiService:
def get_module_help(self, module_name: str) -> Result:
"""Get Python help() output for a module or class.
Args:
module_name: Dotted name (e.g. "td.noiseCHOP", "td.tdu.SomeClass")
or bare name (e.g. "noiseCHOP"). Resolved via
_resolve_help_target then rendered with pydoc.render_doc.
Returns:
Result: success_result with {moduleName, helpText},
or error_result if module not found or rendering fails.
"""
Import
from mcp.services.api_service import TouchDesignerApiService
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| module_name | str | Yes | Dotted name (e.g. `td.noiseCHOP`) or bare name (e.g. `noiseCHOP`) |
Outputs
| Name | Type | Description |
|---|---|---|
| moduleName | str | The requested module name |
| helpText | str | Cleaned `help()` output with backspace control sequences stripped |
Usage Examples
Read Module Documentation
from mcp.services.api_service import TouchDesignerApiService
service = TouchDesignerApiService()
result = service.get_module_help("td.noiseCHOP")
if result["success"]:
print(result["data"]["helpText"])
Read a Utility Class
result = service.get_module_help("td.tdu.Timer")
if result["success"]:
print(result["data"]["helpText"][:500])