touchdesigner-mcp-server
Version:
MCP server for TouchDesigner
29 lines (28 loc) • 1.27 kB
TypeScript
/**
* Python script builder for GET_TOP_IMAGE.
*
* `get_top_image` has no dedicated API endpoint: it reuses the same
* `execute_python_script` channel as EXECUTE_PYTHON_SCRIPT. This module only
* builds the script text that gets sent over that channel.
*/
export interface GetTopImageScriptParams {
nodePath: string;
maxSize?: number;
}
/**
* Builds a Python script that captures the current output of a TOP node as a
* base64-encoded JPEG and assigns it to `result` (the variable the TD-side
* script executor extracts as the return value).
*
* When `maxSize` is set and the TOP's longer dimension exceeds it, a
* temporary `td.resolutionTOP` is chained onto the node to downscale (aspect
* preserved) before capture, then destroyed in a `finally` block so the
* project is left unmodified.
*
* OP type constants are referenced via `td.resolutionTOP` (not the bare
* `resolutionTOP` global) because the bare global is only injected into the
* exec namespace by TD-side packages that include #185's global injection
* fix; `import td` + `td.resolutionTOP` works against both older and newer
* deployed `mcp_webserver_base.tox` packages.
*/
export declare function buildGetTopImageScript({ nodePath, maxSize, }: GetTopImageScriptParams): string;