Implementation:8beeeaaat Touchdesigner mcp Build Tool Metadata
| Knowledge Sources | |
|---|---|
| Domains | Schema_Introspection, Tool_Manifest |
| Last Updated | 2026-10-28 00:00 GMT |
Overview
Concrete tool for building the describe_td_tools manifest by introspecting each tool's Zod schema into flat parameter metadata.
Description
buildToolMetadata maps the TOOL_DEFINITIONS table into a structured ToolMetadata[] manifest. For each tool it derives a camelCase function name from the snake_case tool name, and introspects the tool's ZodObject schema via deriveParameters, peeling optional/default/nullable/nullish wrappers to determine required-ness and rendering the base Zod type as a TypeScript-flavored type string (string, number, Array<...>, Record<...>, enum unions, etc.). Because the metadata is derived from the live Zod schema — itself generated from the OpenAPI spec via Orval — the manifest always reflects the schema actually registered.
Usage
Call when constructing the describe_td_tools tool response so AI agents receive accurate parameter types and required flags for every TouchDesigner tool.
Code Reference
Source Location
- Repository: 8beeeaaat_Touchdesigner_mcp
- File: src/features/tools/metadata/touchDesignerToolMetadata.ts
- Lines: 1-162
Signature
export function buildToolMetadata(
definitions?: readonly ToolDefinition[]
): ToolMetadata[];
export function deriveParameters(
schema: z.ZodObject<z.ZodRawShape>
): ToolParameterMetadata[];
Import
import { buildToolMetadata } from "../metadata/touchDesignerToolMetadata.js";
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| definitions | readonly ToolDefinition[] | No | Tool table (defaults to TOOL_DEFINITIONS) |
Outputs
| Name | Type | Description |
|---|---|---|
| return | ToolMetadata[] | Per-tool: name, functionName, modulePath, category, description, parameters[], returns, example, notes |
Usage Examples
Build and inspect a tool manifest
import { buildToolMetadata } from "../metadata/touchDesignerToolMetadata.js";
const manifest = buildToolMetadata();
for (const tool of manifest) {
console.log(tool.tool, tool.parameters);
// e.g. "get_td_info" -> [{ name: "...", type: "string", required: true, ... }]
}