import type { CallToolResultSchema } from "@modelcontextprotocol/sdk/types.js"; import type { z } from "zod"; import type { ILogger } from "../core/logger.js"; import { createNode as apiCreateNode, deleteNode as apiDeleteNode, execNodeMethod as apiExecNodeMethod, execPythonScript as apiExecPythonScript, getModuleHelp as apiGetModuleHelp, getNodeDetail as apiGetNodeDetail, getNodeErrors as apiGetNodeErrors, getNodes as apiGetNodes, getTdInfo as apiGetTdInfo, getTdPythonClassDetails as apiGetTdPythonClassDetails, getTdPythonClasses as apiGetTdPythonClasses, updateNode as apiUpdateNode, type CreateNodeBody, type DeleteNodeParams, type ExecNodeMethodBody, type ExecPythonScriptBody, type GetModuleHelpParams, type GetNodeDetailParams, type GetNodeErrorsParams, type GetNodesParams, type UpdateNodeBody } from "../gen/endpoints/TouchDesignerAPI.js"; /** * Interface for TouchDesignerClient HTTP operations */ export interface ITouchDesignerApi { execNodeMethod: typeof apiExecNodeMethod; execPythonScript: typeof apiExecPythonScript; getTdInfo: typeof apiGetTdInfo; getNodes: typeof apiGetNodes; getNodeDetail: typeof apiGetNodeDetail; getNodeErrors: typeof apiGetNodeErrors; createNode: typeof apiCreateNode; updateNode: typeof apiUpdateNode; deleteNode: typeof apiDeleteNode; getTdPythonClasses: typeof apiGetTdPythonClasses; getTdPythonClassDetails: typeof apiGetTdPythonClassDetails; getModuleHelp: typeof apiGetModuleHelp; } export type TdResponse = { success: boolean; data: T | null; error: string | null; }; export type ErrorResult = { success: false; error: E; }; export type SuccessResult = { success: true; data: NonNullable; }; export type Result = SuccessResult | ErrorResult; export declare const ERROR_CACHE_TTL_MS: number; export declare const SUCCESS_CACHE_TTL_MS: number; export declare class TouchDesignerClient { private readonly logger; private readonly api; private verifiedCompatibilityError; private cachedCompatibilityCheck; private errorCacheTimestamp; private successCacheTimestamp; private compatibilityNotice; /** * Initialize TouchDesigner client with optional dependencies */ constructor(params?: { logger?: ILogger; httpClient?: ITouchDesignerApi; }); /** * Log debug message */ private logDebug; /** * Check if the cached error should be cleared (TTL expired) */ private shouldClearErrorCache; /** * Check whether the cached successful compatibility check is still valid */ private hasValidSuccessCache; /** * Force the next API call to re-run compatibility verification. * Useful when the user explicitly requests version information. */ private invalidateCompatibilityCache; getAdditionalToolResultContents(): z.infer["content"] | null; /** * Verify compatibility with the TouchDesigner server */ private verifyCompatibility; /** * Wrapper for API calls that require compatibility verification * @private */ private apiCall; /** * Execute a node method */ execNodeMethod>(params: ExecNodeMethodBody): Promise>; /** * Execute a script in TouchDesigner */ execPythonScript(params: ExecPythonScriptBody): Promise>; /** * Get TouchDesigner server information */ getTdInfo(): Promise>; /** * Get list of nodes */ getNodes(params: GetNodesParams): Promise>; /** * Get node properties */ getNodeDetail(params: GetNodeDetailParams): Promise>; /** * Get node error information */ getNodeErrors(params: GetNodeErrorsParams): Promise>; /** * Create a new node */ createNode(params: CreateNodeBody): Promise>; /** * Update node properties */ updateNode(params: UpdateNodeBody): Promise>; /** * Delete a node */ deleteNode(params: DeleteNodeParams): Promise>; /** * Get list of available Python classes/modules in TouchDesigner */ getClasses(): Promise>; /** * Get details of a specific class/module */ getClassDetails(className: string): Promise>; /** * Retrieve Python help() documentation for modules/classes */ getModuleHelp(params: GetModuleHelpParams): Promise>; verifyVersionCompatibility(): Promise<{ success: false; error: Error; } | { success: true; data: { level: "info" | "warning"; message: string; }; }>; /** * Format connection errors with helpful messages */ private formatConnectionError; private checkVersionCompatibility; }