UNPKG

solidworks-mcp-server

Version:

Clean Architecture SolidWorks MCP Server - Production-ready with SOLID principles

384 lines 13 kB
/** * Design Table Resource for SolidWorks MCP * Manages design tables with SQL database integration */ import { z } from 'zod'; import { SolidWorksResource, ValidationResult } from './base.js'; import { SolidWorksAPI } from '../solidworks/api.js'; declare const DesignTableSchema: z.ZodObject<{ tableName: z.ZodString; fileName: z.ZodOptional<z.ZodString>; parameters: z.ZodArray<z.ZodObject<{ name: z.ZodString; type: z.ZodEnum<["dimension", "feature", "configuration", "custom"]>; dataType: z.ZodEnum<["number", "string", "boolean"]>; defaultValue: z.ZodOptional<z.ZodAny>; sqlColumn: z.ZodOptional<z.ZodString>; formula: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { type: "custom" | "dimension" | "feature" | "configuration"; name: string; dataType: "string" | "number" | "boolean"; defaultValue?: any; sqlColumn?: string | undefined; formula?: string | undefined; }, { type: "custom" | "dimension" | "feature" | "configuration"; name: string; dataType: "string" | "number" | "boolean"; defaultValue?: any; sqlColumn?: string | undefined; formula?: string | undefined; }>, "many">; configurations: z.ZodOptional<z.ZodArray<z.ZodObject<{ name: z.ZodString; values: z.ZodRecord<z.ZodString, z.ZodAny>; active: z.ZodDefault<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { values: Record<string, any>; name: string; active: boolean; }, { values: Record<string, any>; name: string; active?: boolean | undefined; }>, "many">>; dataSource: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["file", "sql", "api", "manual"]>; connectionString: z.ZodOptional<z.ZodString>; query: z.ZodOptional<z.ZodString>; filePath: z.ZodOptional<z.ZodString>; apiEndpoint: z.ZodOptional<z.ZodString>; refreshInterval: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { type: "file" | "sql" | "api" | "manual"; connectionString?: string | undefined; query?: string | undefined; filePath?: string | undefined; apiEndpoint?: string | undefined; refreshInterval?: number | undefined; }, { type: "file" | "sql" | "api" | "manual"; connectionString?: string | undefined; query?: string | undefined; filePath?: string | undefined; apiEndpoint?: string | undefined; refreshInterval?: number | undefined; }>>; autoUpdate: z.ZodDefault<z.ZodBoolean>; validation: z.ZodOptional<z.ZodObject<{ enabled: z.ZodDefault<z.ZodBoolean>; rules: z.ZodOptional<z.ZodArray<z.ZodObject<{ parameter: z.ZodString; rule: z.ZodString; message: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; parameter: string; rule: string; }, { message: string; parameter: string; rule: string; }>, "many">>; }, "strip", z.ZodTypeAny, { enabled: boolean; rules?: { message: string; parameter: string; rule: string; }[] | undefined; }, { enabled?: boolean | undefined; rules?: { message: string; parameter: string; rule: string; }[] | undefined; }>>; }, "strip", z.ZodTypeAny, { tableName: string; parameters: { type: "custom" | "dimension" | "feature" | "configuration"; name: string; dataType: "string" | "number" | "boolean"; defaultValue?: any; sqlColumn?: string | undefined; formula?: string | undefined; }[]; autoUpdate: boolean; fileName?: string | undefined; validation?: { enabled: boolean; rules?: { message: string; parameter: string; rule: string; }[] | undefined; } | undefined; configurations?: { values: Record<string, any>; name: string; active: boolean; }[] | undefined; dataSource?: { type: "file" | "sql" | "api" | "manual"; connectionString?: string | undefined; query?: string | undefined; filePath?: string | undefined; apiEndpoint?: string | undefined; refreshInterval?: number | undefined; } | undefined; }, { tableName: string; parameters: { type: "custom" | "dimension" | "feature" | "configuration"; name: string; dataType: "string" | "number" | "boolean"; defaultValue?: any; sqlColumn?: string | undefined; formula?: string | undefined; }[]; fileName?: string | undefined; validation?: { enabled?: boolean | undefined; rules?: { message: string; parameter: string; rule: string; }[] | undefined; } | undefined; configurations?: { values: Record<string, any>; name: string; active?: boolean | undefined; }[] | undefined; dataSource?: { type: "file" | "sql" | "api" | "manual"; connectionString?: string | undefined; query?: string | undefined; filePath?: string | undefined; apiEndpoint?: string | undefined; refreshInterval?: number | undefined; } | undefined; autoUpdate?: boolean | undefined; }>; export type DesignTableConfig = z.infer<typeof DesignTableSchema>; export declare class DesignTableResource extends SolidWorksResource { readonly type = "design-table"; readonly schema: z.ZodObject<{ tableName: z.ZodString; fileName: z.ZodOptional<z.ZodString>; parameters: z.ZodArray<z.ZodObject<{ name: z.ZodString; type: z.ZodEnum<["dimension", "feature", "configuration", "custom"]>; dataType: z.ZodEnum<["number", "string", "boolean"]>; defaultValue: z.ZodOptional<z.ZodAny>; sqlColumn: z.ZodOptional<z.ZodString>; formula: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { type: "custom" | "dimension" | "feature" | "configuration"; name: string; dataType: "string" | "number" | "boolean"; defaultValue?: any; sqlColumn?: string | undefined; formula?: string | undefined; }, { type: "custom" | "dimension" | "feature" | "configuration"; name: string; dataType: "string" | "number" | "boolean"; defaultValue?: any; sqlColumn?: string | undefined; formula?: string | undefined; }>, "many">; configurations: z.ZodOptional<z.ZodArray<z.ZodObject<{ name: z.ZodString; values: z.ZodRecord<z.ZodString, z.ZodAny>; active: z.ZodDefault<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { values: Record<string, any>; name: string; active: boolean; }, { values: Record<string, any>; name: string; active?: boolean | undefined; }>, "many">>; dataSource: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["file", "sql", "api", "manual"]>; connectionString: z.ZodOptional<z.ZodString>; query: z.ZodOptional<z.ZodString>; filePath: z.ZodOptional<z.ZodString>; apiEndpoint: z.ZodOptional<z.ZodString>; refreshInterval: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { type: "file" | "sql" | "api" | "manual"; connectionString?: string | undefined; query?: string | undefined; filePath?: string | undefined; apiEndpoint?: string | undefined; refreshInterval?: number | undefined; }, { type: "file" | "sql" | "api" | "manual"; connectionString?: string | undefined; query?: string | undefined; filePath?: string | undefined; apiEndpoint?: string | undefined; refreshInterval?: number | undefined; }>>; autoUpdate: z.ZodDefault<z.ZodBoolean>; validation: z.ZodOptional<z.ZodObject<{ enabled: z.ZodDefault<z.ZodBoolean>; rules: z.ZodOptional<z.ZodArray<z.ZodObject<{ parameter: z.ZodString; rule: z.ZodString; message: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; parameter: string; rule: string; }, { message: string; parameter: string; rule: string; }>, "many">>; }, "strip", z.ZodTypeAny, { enabled: boolean; rules?: { message: string; parameter: string; rule: string; }[] | undefined; }, { enabled?: boolean | undefined; rules?: { message: string; parameter: string; rule: string; }[] | undefined; }>>; }, "strip", z.ZodTypeAny, { tableName: string; parameters: { type: "custom" | "dimension" | "feature" | "configuration"; name: string; dataType: "string" | "number" | "boolean"; defaultValue?: any; sqlColumn?: string | undefined; formula?: string | undefined; }[]; autoUpdate: boolean; fileName?: string | undefined; validation?: { enabled: boolean; rules?: { message: string; parameter: string; rule: string; }[] | undefined; } | undefined; configurations?: { values: Record<string, any>; name: string; active: boolean; }[] | undefined; dataSource?: { type: "file" | "sql" | "api" | "manual"; connectionString?: string | undefined; query?: string | undefined; filePath?: string | undefined; apiEndpoint?: string | undefined; refreshInterval?: number | undefined; } | undefined; }, { tableName: string; parameters: { type: "custom" | "dimension" | "feature" | "configuration"; name: string; dataType: "string" | "number" | "boolean"; defaultValue?: any; sqlColumn?: string | undefined; formula?: string | undefined; }[]; fileName?: string | undefined; validation?: { enabled?: boolean | undefined; rules?: { message: string; parameter: string; rule: string; }[] | undefined; } | undefined; configurations?: { values: Record<string, any>; name: string; active?: boolean | undefined; }[] | undefined; dataSource?: { type: "file" | "sql" | "api" | "manual"; connectionString?: string | undefined; query?: string | undefined; filePath?: string | undefined; apiEndpoint?: string | undefined; refreshInterval?: number | undefined; } | undefined; autoUpdate?: boolean | undefined; }>; private sqlConnection; constructor(id: string, name: string, properties: DesignTableConfig); /** * Execute design table operations */ execute(api: SolidWorksAPI): Promise<any>; /** * Load data from SQL database */ private loadFromSQL; /** * Get simulated data for testing */ private getSimulatedData; /** * Map SQL row data to design table parameters */ private mapSQLToParameters; /** * Convert value to appropriate data type */ private convertValue; /** * Evaluate formula with row data */ private evaluateFormula; /** * Update design table in SolidWorks */ private updateDesignTable; /** * Convert to VBA code */ toVBACode(): string; /** * Convert to macro code */ toMacroCode(): string; /** * Get required capabilities */ getRequiredCapabilities(): string[]; /** * Sanitize name for VBA */ private sanitizeName; /** * Refresh data from source */ refresh(api: SolidWorksAPI): Promise<void>; /** * Validate design table configuration */ validateConfiguration(): ValidationResult; } export declare function isDesignTableResource(resource: any): resource is DesignTableResource; export {}; //# sourceMappingURL=design-table.d.ts.map