figma-code-agent-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assetServer.d.ts +34 -0
- package/dist/assetServer.js +168 -0
- package/dist/codeGenerator/componentDetector.d.ts +57 -0
- package/dist/codeGenerator/componentDetector.js +171 -0
- package/dist/codeGenerator/index.d.ts +77 -0
- package/dist/codeGenerator/index.js +184 -0
- package/dist/codeGenerator/jsxGenerator.d.ts +46 -0
- package/dist/codeGenerator/jsxGenerator.js +182 -0
- package/dist/codeGenerator/styleConverter.d.ts +95 -0
- package/dist/codeGenerator/styleConverter.js +306 -0
- package/dist/hints.d.ts +14 -0
- package/dist/hints.js +105 -0
- package/dist/hub.d.ts +9 -0
- package/dist/hub.js +252 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +146 -0
- package/dist/sandbox.d.ts +18 -0
- package/dist/sandbox.js +154 -0
- package/dist/toolRegistry.d.ts +19 -0
- package/dist/toolRegistry.js +729 -0
- package/dist/tools/captureScreenshot.d.ts +28 -0
- package/dist/tools/captureScreenshot.js +31 -0
- package/dist/tools/cloneNode.d.ts +43 -0
- package/dist/tools/cloneNode.js +46 -0
- package/dist/tools/createFrame.d.ts +157 -0
- package/dist/tools/createFrame.js +114 -0
- package/dist/tools/createInstance.d.ts +38 -0
- package/dist/tools/createInstance.js +41 -0
- package/dist/tools/createRectangle.d.ts +108 -0
- package/dist/tools/createRectangle.js +77 -0
- package/dist/tools/createText.d.ts +81 -0
- package/dist/tools/createText.js +67 -0
- package/dist/tools/deleteNode.d.ts +15 -0
- package/dist/tools/deleteNode.js +18 -0
- package/dist/tools/execute.d.ts +17 -0
- package/dist/tools/execute.js +68 -0
- package/dist/tools/getCurrentPage.d.ts +16 -0
- package/dist/tools/getCurrentPage.js +19 -0
- package/dist/tools/getDesignContext.d.ts +42 -0
- package/dist/tools/getDesignContext.js +55 -0
- package/dist/tools/getLocalComponents.d.ts +20 -0
- package/dist/tools/getLocalComponents.js +23 -0
- package/dist/tools/getNode.d.ts +30 -0
- package/dist/tools/getNode.js +33 -0
- package/dist/tools/getSelection.d.ts +10 -0
- package/dist/tools/getSelection.js +13 -0
- package/dist/tools/getStyles.d.ts +17 -0
- package/dist/tools/getStyles.js +20 -0
- package/dist/tools/getVariables.d.ts +26 -0
- package/dist/tools/getVariables.js +29 -0
- package/dist/tools/moveNode.d.ts +28 -0
- package/dist/tools/moveNode.js +31 -0
- package/dist/tools/openInEditor.d.ts +21 -0
- package/dist/tools/openInEditor.js +98 -0
- package/dist/tools/searchNodes.d.ts +30 -0
- package/dist/tools/searchNodes.js +46 -0
- package/dist/tools/searchTools.d.ts +28 -0
- package/dist/tools/searchTools.js +28 -0
- package/dist/tools/swapComponent.d.ts +23 -0
- package/dist/tools/swapComponent.js +26 -0
- package/dist/tools/updateNode.d.ts +194 -0
- package/dist/tools/updateNode.js +163 -0
- package/dist/types.d.ts +101 -0
- package/dist/types.js +1 -0
- package/dist/websocket.d.ts +30 -0
- package/dist/websocket.js +282 -0
- package/package.json +29 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const captureScreenshotSchema: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object";
|
|
6
|
+
properties: {
|
|
7
|
+
nodeId: {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
scale: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
default: number;
|
|
15
|
+
minimum: number;
|
|
16
|
+
maximum: number;
|
|
17
|
+
};
|
|
18
|
+
format: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
enum: string[];
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
required: string[];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare function captureScreenshot(params: Record<string, unknown>): Promise<unknown>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { figmaWebSocket } from '../websocket.js';
|
|
2
|
+
export const captureScreenshotSchema = {
|
|
3
|
+
name: 'capture_screenshot',
|
|
4
|
+
description: 'Capture a screenshot of a node as an image. Returns base64-encoded image data.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
nodeId: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'ID of the node to capture',
|
|
11
|
+
},
|
|
12
|
+
scale: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'Scale factor for the export (1 = 100%, 2 = 200%, etc.)',
|
|
15
|
+
default: 1,
|
|
16
|
+
minimum: 0.01,
|
|
17
|
+
maximum: 4,
|
|
18
|
+
},
|
|
19
|
+
format: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Export format',
|
|
22
|
+
enum: ['PNG', 'JPG', 'SVG', 'PDF'],
|
|
23
|
+
default: 'PNG',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
required: ['nodeId'],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export async function captureScreenshot(params) {
|
|
30
|
+
return figmaWebSocket.sendCommand('captureScreenshot', params);
|
|
31
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const cloneNodeSchema: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object";
|
|
6
|
+
properties: {
|
|
7
|
+
nodeId: {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
count: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
default: number;
|
|
15
|
+
};
|
|
16
|
+
parentId: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
offsetX: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
default: number;
|
|
24
|
+
};
|
|
25
|
+
offsetY: {
|
|
26
|
+
type: string;
|
|
27
|
+
description: string;
|
|
28
|
+
default: number;
|
|
29
|
+
};
|
|
30
|
+
modifications: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
returnScreenshot: {
|
|
35
|
+
type: string;
|
|
36
|
+
description: string;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
required: string[];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export declare function cloneNode(params: Record<string, unknown>): Promise<unknown>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { figmaWebSocket } from '../websocket.js';
|
|
2
|
+
export const cloneNodeSchema = {
|
|
3
|
+
name: 'clone_node',
|
|
4
|
+
description: 'Clone/duplicate a node. Can optionally modify properties on the clone. Useful for creating multiple similar elements.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
nodeId: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'ID of the node to clone',
|
|
11
|
+
},
|
|
12
|
+
count: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'Number of clones to create (default 1)',
|
|
15
|
+
default: 1,
|
|
16
|
+
},
|
|
17
|
+
parentId: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'Parent to place clones in (default: same as original)',
|
|
20
|
+
},
|
|
21
|
+
offsetX: {
|
|
22
|
+
type: 'number',
|
|
23
|
+
description: 'X offset for each clone (clones stack with this offset)',
|
|
24
|
+
default: 0,
|
|
25
|
+
},
|
|
26
|
+
offsetY: {
|
|
27
|
+
type: 'number',
|
|
28
|
+
description: 'Y offset for each clone (clones stack with this offset)',
|
|
29
|
+
default: 0,
|
|
30
|
+
},
|
|
31
|
+
modifications: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
description: 'Properties to modify on clones (name, x, y, width, height, etc.)',
|
|
34
|
+
},
|
|
35
|
+
returnScreenshot: {
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
description: 'If true, returns a screenshot of the cloned node(s) for visual verification',
|
|
38
|
+
default: false,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
required: ['nodeId'],
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export async function cloneNode(params) {
|
|
45
|
+
return figmaWebSocket.sendCommand('cloneNode', params);
|
|
46
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
export declare const createFrameSchema: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object";
|
|
6
|
+
properties: {
|
|
7
|
+
name: {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
x: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
default: number;
|
|
15
|
+
};
|
|
16
|
+
y: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
default: number;
|
|
20
|
+
};
|
|
21
|
+
width: {
|
|
22
|
+
type: string;
|
|
23
|
+
description: string;
|
|
24
|
+
default: number;
|
|
25
|
+
};
|
|
26
|
+
height: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
default: number;
|
|
30
|
+
};
|
|
31
|
+
parentId: {
|
|
32
|
+
type: string;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
cornerRadius: {
|
|
36
|
+
type: string;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
fillColor: {
|
|
40
|
+
type: string;
|
|
41
|
+
description: string;
|
|
42
|
+
properties: {
|
|
43
|
+
r: {
|
|
44
|
+
type: string;
|
|
45
|
+
minimum: number;
|
|
46
|
+
maximum: number;
|
|
47
|
+
};
|
|
48
|
+
g: {
|
|
49
|
+
type: string;
|
|
50
|
+
minimum: number;
|
|
51
|
+
maximum: number;
|
|
52
|
+
};
|
|
53
|
+
b: {
|
|
54
|
+
type: string;
|
|
55
|
+
minimum: number;
|
|
56
|
+
maximum: number;
|
|
57
|
+
};
|
|
58
|
+
a: {
|
|
59
|
+
type: string;
|
|
60
|
+
minimum: number;
|
|
61
|
+
maximum: number;
|
|
62
|
+
default: number;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
required: string[];
|
|
66
|
+
};
|
|
67
|
+
strokeColor: {
|
|
68
|
+
type: string;
|
|
69
|
+
description: string;
|
|
70
|
+
properties: {
|
|
71
|
+
r: {
|
|
72
|
+
type: string;
|
|
73
|
+
minimum: number;
|
|
74
|
+
maximum: number;
|
|
75
|
+
};
|
|
76
|
+
g: {
|
|
77
|
+
type: string;
|
|
78
|
+
minimum: number;
|
|
79
|
+
maximum: number;
|
|
80
|
+
};
|
|
81
|
+
b: {
|
|
82
|
+
type: string;
|
|
83
|
+
minimum: number;
|
|
84
|
+
maximum: number;
|
|
85
|
+
};
|
|
86
|
+
a: {
|
|
87
|
+
type: string;
|
|
88
|
+
minimum: number;
|
|
89
|
+
maximum: number;
|
|
90
|
+
default: number;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
required: string[];
|
|
94
|
+
};
|
|
95
|
+
strokeWeight: {
|
|
96
|
+
type: string;
|
|
97
|
+
description: string;
|
|
98
|
+
};
|
|
99
|
+
layoutMode: {
|
|
100
|
+
type: string;
|
|
101
|
+
enum: string[];
|
|
102
|
+
description: string;
|
|
103
|
+
};
|
|
104
|
+
primaryAxisSizingMode: {
|
|
105
|
+
type: string;
|
|
106
|
+
enum: string[];
|
|
107
|
+
description: string;
|
|
108
|
+
};
|
|
109
|
+
counterAxisSizingMode: {
|
|
110
|
+
type: string;
|
|
111
|
+
enum: string[];
|
|
112
|
+
description: string;
|
|
113
|
+
};
|
|
114
|
+
primaryAxisAlignItems: {
|
|
115
|
+
type: string;
|
|
116
|
+
enum: string[];
|
|
117
|
+
description: string;
|
|
118
|
+
};
|
|
119
|
+
counterAxisAlignItems: {
|
|
120
|
+
type: string;
|
|
121
|
+
enum: string[];
|
|
122
|
+
description: string;
|
|
123
|
+
};
|
|
124
|
+
itemSpacing: {
|
|
125
|
+
type: string;
|
|
126
|
+
description: string;
|
|
127
|
+
};
|
|
128
|
+
padding: {
|
|
129
|
+
type: string;
|
|
130
|
+
description: string;
|
|
131
|
+
};
|
|
132
|
+
paddingTop: {
|
|
133
|
+
type: string;
|
|
134
|
+
description: string;
|
|
135
|
+
};
|
|
136
|
+
paddingBottom: {
|
|
137
|
+
type: string;
|
|
138
|
+
description: string;
|
|
139
|
+
};
|
|
140
|
+
paddingLeft: {
|
|
141
|
+
type: string;
|
|
142
|
+
description: string;
|
|
143
|
+
};
|
|
144
|
+
paddingRight: {
|
|
145
|
+
type: string;
|
|
146
|
+
description: string;
|
|
147
|
+
};
|
|
148
|
+
returnScreenshot: {
|
|
149
|
+
type: string;
|
|
150
|
+
description: string;
|
|
151
|
+
default: boolean;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
required: string[];
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
export declare function createFrame(params: Record<string, unknown>): Promise<unknown>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { figmaWebSocket } from '../websocket.js';
|
|
2
|
+
export const createFrameSchema = {
|
|
3
|
+
name: 'create_frame',
|
|
4
|
+
description: 'Create a new frame in Figma. Frames are containers that can hold other elements.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
name: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Name of the frame',
|
|
11
|
+
},
|
|
12
|
+
x: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'X position of the frame',
|
|
15
|
+
default: 0,
|
|
16
|
+
},
|
|
17
|
+
y: {
|
|
18
|
+
type: 'number',
|
|
19
|
+
description: 'Y position of the frame',
|
|
20
|
+
default: 0,
|
|
21
|
+
},
|
|
22
|
+
width: {
|
|
23
|
+
type: 'number',
|
|
24
|
+
description: 'Width of the frame',
|
|
25
|
+
default: 100,
|
|
26
|
+
},
|
|
27
|
+
height: {
|
|
28
|
+
type: 'number',
|
|
29
|
+
description: 'Height of the frame',
|
|
30
|
+
default: 100,
|
|
31
|
+
},
|
|
32
|
+
parentId: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'ID of the parent node to create the frame in. If not provided, creates at root level.',
|
|
35
|
+
},
|
|
36
|
+
cornerRadius: {
|
|
37
|
+
type: 'number',
|
|
38
|
+
description: 'Corner radius of the frame',
|
|
39
|
+
},
|
|
40
|
+
fillColor: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
description: 'Fill color of the frame (RGB values from 0-1)',
|
|
43
|
+
properties: {
|
|
44
|
+
r: { type: 'number', minimum: 0, maximum: 1 },
|
|
45
|
+
g: { type: 'number', minimum: 0, maximum: 1 },
|
|
46
|
+
b: { type: 'number', minimum: 0, maximum: 1 },
|
|
47
|
+
a: { type: 'number', minimum: 0, maximum: 1, default: 1 },
|
|
48
|
+
},
|
|
49
|
+
required: ['r', 'g', 'b'],
|
|
50
|
+
},
|
|
51
|
+
strokeColor: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
description: 'Stroke/border color (RGB values from 0-1)',
|
|
54
|
+
properties: {
|
|
55
|
+
r: { type: 'number', minimum: 0, maximum: 1 },
|
|
56
|
+
g: { type: 'number', minimum: 0, maximum: 1 },
|
|
57
|
+
b: { type: 'number', minimum: 0, maximum: 1 },
|
|
58
|
+
a: { type: 'number', minimum: 0, maximum: 1, default: 1 },
|
|
59
|
+
},
|
|
60
|
+
required: ['r', 'g', 'b'],
|
|
61
|
+
},
|
|
62
|
+
strokeWeight: {
|
|
63
|
+
type: 'number',
|
|
64
|
+
description: 'Stroke/border width in pixels',
|
|
65
|
+
},
|
|
66
|
+
layoutMode: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
enum: ['NONE', 'HORIZONTAL', 'VERTICAL'],
|
|
69
|
+
description: 'Auto-layout direction. HORIZONTAL = row, VERTICAL = column',
|
|
70
|
+
},
|
|
71
|
+
primaryAxisSizingMode: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
enum: ['FIXED', 'AUTO'],
|
|
74
|
+
description: 'How the frame sizes along primary axis (FIXED = fixed size, AUTO = hug)',
|
|
75
|
+
},
|
|
76
|
+
counterAxisSizingMode: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
enum: ['FIXED', 'AUTO'],
|
|
79
|
+
description: 'How the frame sizes along counter axis',
|
|
80
|
+
},
|
|
81
|
+
primaryAxisAlignItems: {
|
|
82
|
+
type: 'string',
|
|
83
|
+
enum: ['MIN', 'CENTER', 'MAX', 'SPACE_BETWEEN'],
|
|
84
|
+
description: 'Alignment of children along primary axis',
|
|
85
|
+
},
|
|
86
|
+
counterAxisAlignItems: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
enum: ['MIN', 'CENTER', 'MAX', 'BASELINE'],
|
|
89
|
+
description: 'Alignment of children along counter axis',
|
|
90
|
+
},
|
|
91
|
+
itemSpacing: {
|
|
92
|
+
type: 'number',
|
|
93
|
+
description: 'Gap between children in pixels',
|
|
94
|
+
},
|
|
95
|
+
padding: {
|
|
96
|
+
type: 'number',
|
|
97
|
+
description: 'Padding on all sides in pixels',
|
|
98
|
+
},
|
|
99
|
+
paddingTop: { type: 'number', description: 'Top padding' },
|
|
100
|
+
paddingBottom: { type: 'number', description: 'Bottom padding' },
|
|
101
|
+
paddingLeft: { type: 'number', description: 'Left padding' },
|
|
102
|
+
paddingRight: { type: 'number', description: 'Right padding' },
|
|
103
|
+
returnScreenshot: {
|
|
104
|
+
type: 'boolean',
|
|
105
|
+
description: 'If true, returns a screenshot of the created frame for visual verification',
|
|
106
|
+
default: false,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
required: ['name'],
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
export async function createFrame(params) {
|
|
113
|
+
return figmaWebSocket.sendCommand('createFrame', params);
|
|
114
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const createInstanceSchema: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object";
|
|
6
|
+
properties: {
|
|
7
|
+
componentKey: {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
componentId: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
x: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
default: number;
|
|
19
|
+
};
|
|
20
|
+
y: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
default: number;
|
|
24
|
+
};
|
|
25
|
+
parentId: {
|
|
26
|
+
type: string;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
returnScreenshot: {
|
|
30
|
+
type: string;
|
|
31
|
+
description: string;
|
|
32
|
+
default: boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
required: never[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export declare function createInstance(params: Record<string, unknown>): Promise<unknown>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { figmaWebSocket } from '../websocket.js';
|
|
2
|
+
export const createInstanceSchema = {
|
|
3
|
+
name: 'create_instance',
|
|
4
|
+
description: 'Create an instance of a component in Figma. Works with both local (unpublished) and library (published) components.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
componentKey: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'The key of the component (works for both local and published components)',
|
|
11
|
+
},
|
|
12
|
+
componentId: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'The node ID of a local component (use this for unpublished components)',
|
|
15
|
+
},
|
|
16
|
+
x: {
|
|
17
|
+
type: 'number',
|
|
18
|
+
description: 'X position of the instance',
|
|
19
|
+
default: 0,
|
|
20
|
+
},
|
|
21
|
+
y: {
|
|
22
|
+
type: 'number',
|
|
23
|
+
description: 'Y position of the instance',
|
|
24
|
+
default: 0,
|
|
25
|
+
},
|
|
26
|
+
parentId: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'ID of the parent node to create the instance in.',
|
|
29
|
+
},
|
|
30
|
+
returnScreenshot: {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
description: 'If true, returns a screenshot of the created instance for visual verification',
|
|
33
|
+
default: false,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
required: [],
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export async function createInstance(params) {
|
|
40
|
+
return figmaWebSocket.sendCommand('createInstance', params);
|
|
41
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export declare const createRectangleSchema: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object";
|
|
6
|
+
properties: {
|
|
7
|
+
name: {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
x: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
default: number;
|
|
15
|
+
};
|
|
16
|
+
y: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
default: number;
|
|
20
|
+
};
|
|
21
|
+
width: {
|
|
22
|
+
type: string;
|
|
23
|
+
description: string;
|
|
24
|
+
default: number;
|
|
25
|
+
};
|
|
26
|
+
height: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
default: number;
|
|
30
|
+
};
|
|
31
|
+
fillColor: {
|
|
32
|
+
type: string;
|
|
33
|
+
description: string;
|
|
34
|
+
properties: {
|
|
35
|
+
r: {
|
|
36
|
+
type: string;
|
|
37
|
+
minimum: number;
|
|
38
|
+
maximum: number;
|
|
39
|
+
};
|
|
40
|
+
g: {
|
|
41
|
+
type: string;
|
|
42
|
+
minimum: number;
|
|
43
|
+
maximum: number;
|
|
44
|
+
};
|
|
45
|
+
b: {
|
|
46
|
+
type: string;
|
|
47
|
+
minimum: number;
|
|
48
|
+
maximum: number;
|
|
49
|
+
};
|
|
50
|
+
a: {
|
|
51
|
+
type: string;
|
|
52
|
+
minimum: number;
|
|
53
|
+
maximum: number;
|
|
54
|
+
default: number;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
required: string[];
|
|
58
|
+
};
|
|
59
|
+
parentId: {
|
|
60
|
+
type: string;
|
|
61
|
+
description: string;
|
|
62
|
+
};
|
|
63
|
+
cornerRadius: {
|
|
64
|
+
type: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
strokeColor: {
|
|
68
|
+
type: string;
|
|
69
|
+
description: string;
|
|
70
|
+
properties: {
|
|
71
|
+
r: {
|
|
72
|
+
type: string;
|
|
73
|
+
minimum: number;
|
|
74
|
+
maximum: number;
|
|
75
|
+
};
|
|
76
|
+
g: {
|
|
77
|
+
type: string;
|
|
78
|
+
minimum: number;
|
|
79
|
+
maximum: number;
|
|
80
|
+
};
|
|
81
|
+
b: {
|
|
82
|
+
type: string;
|
|
83
|
+
minimum: number;
|
|
84
|
+
maximum: number;
|
|
85
|
+
};
|
|
86
|
+
a: {
|
|
87
|
+
type: string;
|
|
88
|
+
minimum: number;
|
|
89
|
+
maximum: number;
|
|
90
|
+
default: number;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
required: string[];
|
|
94
|
+
};
|
|
95
|
+
strokeWeight: {
|
|
96
|
+
type: string;
|
|
97
|
+
description: string;
|
|
98
|
+
};
|
|
99
|
+
returnScreenshot: {
|
|
100
|
+
type: string;
|
|
101
|
+
description: string;
|
|
102
|
+
default: boolean;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
required: never[];
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
export declare function createRectangle(params: Record<string, unknown>): Promise<unknown>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { figmaWebSocket } from '../websocket.js';
|
|
2
|
+
export const createRectangleSchema = {
|
|
3
|
+
name: 'create_rectangle',
|
|
4
|
+
description: 'Create a new rectangle shape in Figma.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
name: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Name of the rectangle',
|
|
11
|
+
},
|
|
12
|
+
x: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'X position of the rectangle',
|
|
15
|
+
default: 0,
|
|
16
|
+
},
|
|
17
|
+
y: {
|
|
18
|
+
type: 'number',
|
|
19
|
+
description: 'Y position of the rectangle',
|
|
20
|
+
default: 0,
|
|
21
|
+
},
|
|
22
|
+
width: {
|
|
23
|
+
type: 'number',
|
|
24
|
+
description: 'Width of the rectangle',
|
|
25
|
+
default: 100,
|
|
26
|
+
},
|
|
27
|
+
height: {
|
|
28
|
+
type: 'number',
|
|
29
|
+
description: 'Height of the rectangle',
|
|
30
|
+
default: 100,
|
|
31
|
+
},
|
|
32
|
+
fillColor: {
|
|
33
|
+
type: 'object',
|
|
34
|
+
description: 'Fill color of the rectangle (RGB values from 0-1)',
|
|
35
|
+
properties: {
|
|
36
|
+
r: { type: 'number', minimum: 0, maximum: 1 },
|
|
37
|
+
g: { type: 'number', minimum: 0, maximum: 1 },
|
|
38
|
+
b: { type: 'number', minimum: 0, maximum: 1 },
|
|
39
|
+
a: { type: 'number', minimum: 0, maximum: 1, default: 1 },
|
|
40
|
+
},
|
|
41
|
+
required: ['r', 'g', 'b'],
|
|
42
|
+
},
|
|
43
|
+
parentId: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'ID of the parent node to create the rectangle in.',
|
|
46
|
+
},
|
|
47
|
+
cornerRadius: {
|
|
48
|
+
type: 'number',
|
|
49
|
+
description: 'Corner radius of the rectangle',
|
|
50
|
+
},
|
|
51
|
+
strokeColor: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
description: 'Stroke/border color (RGB values from 0-1)',
|
|
54
|
+
properties: {
|
|
55
|
+
r: { type: 'number', minimum: 0, maximum: 1 },
|
|
56
|
+
g: { type: 'number', minimum: 0, maximum: 1 },
|
|
57
|
+
b: { type: 'number', minimum: 0, maximum: 1 },
|
|
58
|
+
a: { type: 'number', minimum: 0, maximum: 1, default: 1 },
|
|
59
|
+
},
|
|
60
|
+
required: ['r', 'g', 'b'],
|
|
61
|
+
},
|
|
62
|
+
strokeWeight: {
|
|
63
|
+
type: 'number',
|
|
64
|
+
description: 'Stroke/border width in pixels',
|
|
65
|
+
},
|
|
66
|
+
returnScreenshot: {
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
description: 'If true, returns a screenshot of the created element for visual verification',
|
|
69
|
+
default: false,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
required: [],
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
export async function createRectangle(params) {
|
|
76
|
+
return figmaWebSocket.sendCommand('createRectangle', params);
|
|
77
|
+
}
|