@alisaitteke/photoshop-mcp 0.1.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.
Files changed (115) hide show
  1. package/.prettierrc +9 -0
  2. package/README.md +1300 -0
  3. package/dist/api/batch-play.d.ts +62 -0
  4. package/dist/api/batch-play.d.ts.map +1 -0
  5. package/dist/api/batch-play.js +131 -0
  6. package/dist/api/batch-play.js.map +1 -0
  7. package/dist/api/extendscript.d.ts +258 -0
  8. package/dist/api/extendscript.d.ts.map +1 -0
  9. package/dist/api/extendscript.js +1437 -0
  10. package/dist/api/extendscript.js.map +1 -0
  11. package/dist/api/photoshop-api.d.ts +20 -0
  12. package/dist/api/photoshop-api.d.ts.map +1 -0
  13. package/dist/api/photoshop-api.js +88 -0
  14. package/dist/api/photoshop-api.js.map +1 -0
  15. package/dist/core/server.d.ts +14 -0
  16. package/dist/core/server.d.ts.map +1 -0
  17. package/dist/core/server.js +191 -0
  18. package/dist/core/server.js.map +1 -0
  19. package/dist/core/session.d.ts +24 -0
  20. package/dist/core/session.d.ts.map +1 -0
  21. package/dist/core/session.js +83 -0
  22. package/dist/core/session.js.map +1 -0
  23. package/dist/core/tool-registry.d.ts +23 -0
  24. package/dist/core/tool-registry.d.ts.map +1 -0
  25. package/dist/core/tool-registry.js +55 -0
  26. package/dist/core/tool-registry.js.map +1 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +18 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/platform/connection.d.ts +20 -0
  32. package/dist/platform/connection.d.ts.map +1 -0
  33. package/dist/platform/connection.js +94 -0
  34. package/dist/platform/connection.js.map +1 -0
  35. package/dist/platform/detector.d.ts +19 -0
  36. package/dist/platform/detector.d.ts.map +1 -0
  37. package/dist/platform/detector.js +63 -0
  38. package/dist/platform/detector.js.map +1 -0
  39. package/dist/platform/macos-detector.d.ts +13 -0
  40. package/dist/platform/macos-detector.d.ts.map +1 -0
  41. package/dist/platform/macos-detector.js +145 -0
  42. package/dist/platform/macos-detector.js.map +1 -0
  43. package/dist/platform/macos-executor.d.ts +22 -0
  44. package/dist/platform/macos-executor.d.ts.map +1 -0
  45. package/dist/platform/macos-executor.js +161 -0
  46. package/dist/platform/macos-executor.js.map +1 -0
  47. package/dist/platform/script-executor.d.ts +23 -0
  48. package/dist/platform/script-executor.d.ts.map +1 -0
  49. package/dist/platform/script-executor.js +2 -0
  50. package/dist/platform/script-executor.js.map +1 -0
  51. package/dist/platform/windows-detector.d.ts +14 -0
  52. package/dist/platform/windows-detector.d.ts.map +1 -0
  53. package/dist/platform/windows-detector.js +173 -0
  54. package/dist/platform/windows-detector.js.map +1 -0
  55. package/dist/platform/windows-executor.d.ts +15 -0
  56. package/dist/platform/windows-executor.d.ts.map +1 -0
  57. package/dist/platform/windows-executor.js +148 -0
  58. package/dist/platform/windows-executor.js.map +1 -0
  59. package/dist/tools/action-tools.d.ts +4 -0
  60. package/dist/tools/action-tools.d.ts.map +1 -0
  61. package/dist/tools/action-tools.js +102 -0
  62. package/dist/tools/action-tools.js.map +1 -0
  63. package/dist/tools/adjustment-tools.d.ts +4 -0
  64. package/dist/tools/adjustment-tools.d.ts.map +1 -0
  65. package/dist/tools/adjustment-tools.js +274 -0
  66. package/dist/tools/adjustment-tools.js.map +1 -0
  67. package/dist/tools/document-tools.d.ts +4 -0
  68. package/dist/tools/document-tools.d.ts.map +1 -0
  69. package/dist/tools/document-tools.js +230 -0
  70. package/dist/tools/document-tools.js.map +1 -0
  71. package/dist/tools/filter-tools.d.ts +4 -0
  72. package/dist/tools/filter-tools.d.ts.map +1 -0
  73. package/dist/tools/filter-tools.js +230 -0
  74. package/dist/tools/filter-tools.js.map +1 -0
  75. package/dist/tools/history-tools.d.ts +4 -0
  76. package/dist/tools/history-tools.d.ts.map +1 -0
  77. package/dist/tools/history-tools.js +137 -0
  78. package/dist/tools/history-tools.js.map +1 -0
  79. package/dist/tools/image-placement-tools.d.ts +4 -0
  80. package/dist/tools/image-placement-tools.d.ts.map +1 -0
  81. package/dist/tools/image-placement-tools.js +109 -0
  82. package/dist/tools/image-placement-tools.js.map +1 -0
  83. package/dist/tools/image-tools.d.ts +4 -0
  84. package/dist/tools/image-tools.d.ts.map +1 -0
  85. package/dist/tools/image-tools.js +123 -0
  86. package/dist/tools/image-tools.js.map +1 -0
  87. package/dist/tools/layer-ordering-tools.d.ts +4 -0
  88. package/dist/tools/layer-ordering-tools.d.ts.map +1 -0
  89. package/dist/tools/layer-ordering-tools.js +210 -0
  90. package/dist/tools/layer-ordering-tools.js.map +1 -0
  91. package/dist/tools/layer-properties-tools.d.ts +4 -0
  92. package/dist/tools/layer-properties-tools.d.ts.map +1 -0
  93. package/dist/tools/layer-properties-tools.js +421 -0
  94. package/dist/tools/layer-properties-tools.js.map +1 -0
  95. package/dist/tools/layer-tools.d.ts +4 -0
  96. package/dist/tools/layer-tools.d.ts.map +1 -0
  97. package/dist/tools/layer-tools.js +251 -0
  98. package/dist/tools/layer-tools.js.map +1 -0
  99. package/dist/tools/layer-transform-tools.d.ts +4 -0
  100. package/dist/tools/layer-transform-tools.d.ts.map +1 -0
  101. package/dist/tools/layer-transform-tools.js +199 -0
  102. package/dist/tools/layer-transform-tools.js.map +1 -0
  103. package/dist/tools/selection-tools.d.ts +4 -0
  104. package/dist/tools/selection-tools.d.ts.map +1 -0
  105. package/dist/tools/selection-tools.js +295 -0
  106. package/dist/tools/selection-tools.js.map +1 -0
  107. package/dist/tools/text-tools.d.ts +4 -0
  108. package/dist/tools/text-tools.d.ts.map +1 -0
  109. package/dist/tools/text-tools.js +210 -0
  110. package/dist/tools/text-tools.js.map +1 -0
  111. package/dist/utils/logger.d.ts +17 -0
  112. package/dist/utils/logger.d.ts.map +1 -0
  113. package/dist/utils/logger.js +43 -0
  114. package/dist/utils/logger.js.map +1 -0
  115. package/package.json +47 -0
@@ -0,0 +1,230 @@
1
+ import { PhotoshopAPIFactory } from '../api/photoshop-api.js';
2
+ import { ExtendScriptSnippets } from '../api/extendscript.js';
3
+ export function createFilterTools(connection) {
4
+ return [
5
+ {
6
+ tool: {
7
+ name: 'photoshop_apply_gaussian_blur',
8
+ description: 'Apply Gaussian Blur filter to the active layer',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ radius: {
13
+ type: 'number',
14
+ description: 'Blur radius in pixels (0.1-250)',
15
+ minimum: 0.1,
16
+ maximum: 250,
17
+ },
18
+ },
19
+ required: ['radius'],
20
+ },
21
+ },
22
+ handler: async (args) => applyGaussianBlur(connection, args),
23
+ },
24
+ {
25
+ tool: {
26
+ name: 'photoshop_apply_sharpen',
27
+ description: 'Apply Unsharp Mask (sharpen) filter to the active layer',
28
+ inputSchema: {
29
+ type: 'object',
30
+ properties: {
31
+ amount: {
32
+ type: 'number',
33
+ description: 'Sharpening amount in percent (1-500)',
34
+ minimum: 1,
35
+ maximum: 500,
36
+ },
37
+ radius: {
38
+ type: 'number',
39
+ description: 'Radius in pixels (0.1-250)',
40
+ minimum: 0.1,
41
+ maximum: 250,
42
+ },
43
+ threshold: {
44
+ type: 'number',
45
+ description: 'Threshold levels (0-255)',
46
+ minimum: 0,
47
+ maximum: 255,
48
+ default: 0,
49
+ },
50
+ },
51
+ required: ['amount', 'radius'],
52
+ },
53
+ },
54
+ handler: async (args) => applySharpen(connection, args),
55
+ },
56
+ {
57
+ tool: {
58
+ name: 'photoshop_apply_noise',
59
+ description: 'Apply Add Noise filter to the active layer',
60
+ inputSchema: {
61
+ type: 'object',
62
+ properties: {
63
+ amount: {
64
+ type: 'number',
65
+ description: 'Noise amount in percent (0.1-400)',
66
+ minimum: 0.1,
67
+ maximum: 400,
68
+ },
69
+ distribution: {
70
+ type: 'string',
71
+ description: 'Noise distribution type',
72
+ enum: ['UNIFORM', 'GAUSSIAN'],
73
+ default: 'UNIFORM',
74
+ },
75
+ monochromatic: {
76
+ type: 'boolean',
77
+ description: 'Apply monochromatic noise',
78
+ default: false,
79
+ },
80
+ },
81
+ required: ['amount'],
82
+ },
83
+ },
84
+ handler: async (args) => applyNoise(connection, args),
85
+ },
86
+ {
87
+ tool: {
88
+ name: 'photoshop_apply_motion_blur',
89
+ description: 'Apply Motion Blur filter to the active layer',
90
+ inputSchema: {
91
+ type: 'object',
92
+ properties: {
93
+ angle: {
94
+ type: 'number',
95
+ description: 'Blur angle in degrees (-360 to 360)',
96
+ minimum: -360,
97
+ maximum: 360,
98
+ },
99
+ radius: {
100
+ type: 'number',
101
+ description: 'Blur distance in pixels (1-999)',
102
+ minimum: 1,
103
+ maximum: 999,
104
+ },
105
+ },
106
+ required: ['angle', 'radius'],
107
+ },
108
+ },
109
+ handler: async (args) => applyMotionBlur(connection, args),
110
+ },
111
+ ];
112
+ }
113
+ async function applyGaussianBlur(connection, args) {
114
+ const radius = args.radius;
115
+ try {
116
+ const apiFactory = new PhotoshopAPIFactory(connection);
117
+ const api = await apiFactory.createAPI();
118
+ const script = ExtendScriptSnippets.applyGaussianBlur(radius);
119
+ await api.executeScript(script);
120
+ return {
121
+ content: [
122
+ {
123
+ type: 'text',
124
+ text: `Gaussian Blur applied with radius ${radius}px`,
125
+ },
126
+ ],
127
+ };
128
+ }
129
+ catch (error) {
130
+ return {
131
+ content: [
132
+ {
133
+ type: 'text',
134
+ text: `Error applying Gaussian Blur: ${error instanceof Error ? error.message : String(error)}`,
135
+ },
136
+ ],
137
+ isError: true,
138
+ };
139
+ }
140
+ }
141
+ async function applySharpen(connection, args) {
142
+ const amount = args.amount;
143
+ const radius = args.radius;
144
+ const threshold = args.threshold || 0;
145
+ try {
146
+ const apiFactory = new PhotoshopAPIFactory(connection);
147
+ const api = await apiFactory.createAPI();
148
+ const script = ExtendScriptSnippets.applyUnsharpMask(amount, radius, threshold);
149
+ await api.executeScript(script);
150
+ return {
151
+ content: [
152
+ {
153
+ type: 'text',
154
+ text: `Unsharp Mask applied: amount ${amount}%, radius ${radius}px, threshold ${threshold}`,
155
+ },
156
+ ],
157
+ };
158
+ }
159
+ catch (error) {
160
+ return {
161
+ content: [
162
+ {
163
+ type: 'text',
164
+ text: `Error applying sharpen: ${error instanceof Error ? error.message : String(error)}`,
165
+ },
166
+ ],
167
+ isError: true,
168
+ };
169
+ }
170
+ }
171
+ async function applyNoise(connection, args) {
172
+ const amount = args.amount;
173
+ const distribution = args.distribution || 'UNIFORM';
174
+ const monochromatic = args.monochromatic || false;
175
+ try {
176
+ const apiFactory = new PhotoshopAPIFactory(connection);
177
+ const api = await apiFactory.createAPI();
178
+ const script = ExtendScriptSnippets.applyAddNoise(amount, distribution, monochromatic);
179
+ await api.executeScript(script);
180
+ return {
181
+ content: [
182
+ {
183
+ type: 'text',
184
+ text: `Add Noise applied: ${amount}% (${distribution}${monochromatic ? ', monochromatic' : ''})`,
185
+ },
186
+ ],
187
+ };
188
+ }
189
+ catch (error) {
190
+ return {
191
+ content: [
192
+ {
193
+ type: 'text',
194
+ text: `Error applying noise: ${error instanceof Error ? error.message : String(error)}`,
195
+ },
196
+ ],
197
+ isError: true,
198
+ };
199
+ }
200
+ }
201
+ async function applyMotionBlur(connection, args) {
202
+ const angle = args.angle;
203
+ const radius = args.radius;
204
+ try {
205
+ const apiFactory = new PhotoshopAPIFactory(connection);
206
+ const api = await apiFactory.createAPI();
207
+ const script = ExtendScriptSnippets.applyMotionBlur(angle, radius);
208
+ await api.executeScript(script);
209
+ return {
210
+ content: [
211
+ {
212
+ type: 'text',
213
+ text: `Motion Blur applied: angle ${angle}°, radius ${radius}px`,
214
+ },
215
+ ],
216
+ };
217
+ }
218
+ catch (error) {
219
+ return {
220
+ content: [
221
+ {
222
+ type: 'text',
223
+ text: `Error applying motion blur: ${error instanceof Error ? error.message : String(error)}`,
224
+ },
225
+ ],
226
+ isError: true,
227
+ };
228
+ }
229
+ }
230
+ //# sourceMappingURL=filter-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-tools.js","sourceRoot":"","sources":["../../src/tools/filter-tools.ts"],"names":[],"mappings":"AAEA,O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
@@ -0,0 +1,4 @@
1
+ import { ToolDefinition } from '../core/tool-registry.js';
2
+ import { PhotoshopConnection } from '../platform/connection.js';
3
+ export declare function createHistoryTools(connection: PhotoshopConnection): ToolDefinition[];
4
+ //# sourceMappingURL=history-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history-tools.d.ts","sourceRoot":"","sources":["../../src/tools/history-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAc,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,mBAAmB,GAAG,cAAc,EAAE,CAkDpF"}
@@ -0,0 +1,137 @@
1
+ import { PhotoshopAPIFactory } from '../api/photoshop-api.js';
2
+ import { ExtendScriptSnippets } from '../api/extendscript.js';
3
+ export function createHistoryTools(connection) {
4
+ return [
5
+ {
6
+ tool: {
7
+ name: 'photoshop_undo',
8
+ description: 'Undo the last operation(s) - equivalent to Ctrl/Cmd+Z',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ steps: {
13
+ type: 'number',
14
+ description: 'Number of steps to undo (default: 1)',
15
+ minimum: 1,
16
+ default: 1,
17
+ },
18
+ },
19
+ },
20
+ },
21
+ handler: async (args) => undo(connection, args),
22
+ },
23
+ {
24
+ tool: {
25
+ name: 'photoshop_redo',
26
+ description: 'Redo the previously undone operation(s) - equivalent to Ctrl/Cmd+Shift+Z',
27
+ inputSchema: {
28
+ type: 'object',
29
+ properties: {
30
+ steps: {
31
+ type: 'number',
32
+ description: 'Number of steps to redo (default: 1)',
33
+ minimum: 1,
34
+ default: 1,
35
+ },
36
+ },
37
+ },
38
+ },
39
+ handler: async (args) => redo(connection, args),
40
+ },
41
+ {
42
+ tool: {
43
+ name: 'photoshop_get_history',
44
+ description: 'Get the history states of the active document',
45
+ inputSchema: {
46
+ type: 'object',
47
+ properties: {},
48
+ },
49
+ },
50
+ handler: async () => getHistory(connection),
51
+ },
52
+ ];
53
+ }
54
+ async function undo(connection, args) {
55
+ const steps = args.steps || 1;
56
+ try {
57
+ const apiFactory = new PhotoshopAPIFactory(connection);
58
+ const api = await apiFactory.createAPI();
59
+ const script = ExtendScriptSnippets.undo(steps);
60
+ const result = await api.executeScript(script);
61
+ return {
62
+ content: [
63
+ {
64
+ type: 'text',
65
+ text: `Undo successful (${steps} step${steps > 1 ? 's' : ''})\nResult: ${JSON.stringify(result)}`,
66
+ },
67
+ ],
68
+ };
69
+ }
70
+ catch (error) {
71
+ return {
72
+ content: [
73
+ {
74
+ type: 'text',
75
+ text: `Error undoing: ${error instanceof Error ? error.message : String(error)}`,
76
+ },
77
+ ],
78
+ isError: true,
79
+ };
80
+ }
81
+ }
82
+ async function redo(connection, args) {
83
+ const steps = args.steps || 1;
84
+ try {
85
+ const apiFactory = new PhotoshopAPIFactory(connection);
86
+ const api = await apiFactory.createAPI();
87
+ const script = ExtendScriptSnippets.redo(steps);
88
+ const result = await api.executeScript(script);
89
+ return {
90
+ content: [
91
+ {
92
+ type: 'text',
93
+ text: `Redo successful (${steps} step${steps > 1 ? 's' : ''})\nResult: ${JSON.stringify(result)}`,
94
+ },
95
+ ],
96
+ };
97
+ }
98
+ catch (error) {
99
+ return {
100
+ content: [
101
+ {
102
+ type: 'text',
103
+ text: `Error redoing: ${error instanceof Error ? error.message : String(error)}`,
104
+ },
105
+ ],
106
+ isError: true,
107
+ };
108
+ }
109
+ }
110
+ async function getHistory(connection) {
111
+ try {
112
+ const apiFactory = new PhotoshopAPIFactory(connection);
113
+ const api = await apiFactory.createAPI();
114
+ const script = ExtendScriptSnippets.getHistoryStates();
115
+ const result = await api.executeScript(script);
116
+ return {
117
+ content: [
118
+ {
119
+ type: 'text',
120
+ text: `History States:\n${JSON.stringify(result, null, 2)}`,
121
+ },
122
+ ],
123
+ };
124
+ }
125
+ catch (error) {
126
+ return {
127
+ content: [
128
+ {
129
+ type: 'text',
130
+ text: `Error getting history: ${error instanceof Error ? error.message : String(error)}`,
131
+ },
132
+ ],
133
+ isError: true,
134
+ };
135
+ }
136
+ }
137
+ //# sourceMappingURL=history-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history-tools.js","sourceRoot":"","sources":["../../src/tools/history-tools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,UAAU,kBAAkB,CAAC,UAA+B;IAChE,OAAO;QACL;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,gBAAgB;gBACtB,WAAW,EAAE,uDAAuD;gBACpE,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,sCAAsC;4BACnD,OAAO,EAAE,CAAC;4BACV,OAAO,EAAE,CAAC;yBACX;qBACF;iBACF;aACF;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC;SAChD;QACD;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,gBAAgB;gBACtB,WAAW,EAAE,0EAA0E;gBACvF,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,sCAAsC;4BACnD,OAAO,EAAE,CAAC;4BACV,OAAO,EAAE,CAAC;yBACX;qBACF;iBACF;aACF;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC;SAChD;QACD;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,uBAAuB;gBAC7B,WAAW,EAAE,+CAA+C;gBAC5D,WAAW,EAAE;oBACX,IAAI,EAAE,QA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AC5D;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,0BAA0B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBACzF;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ToolDefinition } from '../core/tool-registry.js';
2
+ import { PhotoshopConnection } from '../platform/connection.js';
3
+ export declare function createImagePlacementTools(connection: PhotoshopConnection): ToolDefinition[];
4
+ //# sourceMappingURL=image-placement-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-placement-tools.d.ts","sourceRoot":"","sources":["../../src/tools/image-placement-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAc,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,mBAAmB,GAAG,cAAc,EAAE,CA+C3F"}
@@ -0,0 +1,109 @@
1
+ import { PhotoshopAPIFactory } from '../api/photoshop-api.js';
2
+ import { ExtendScriptSnippets } from '../api/extendscript.js';
3
+ export function createImagePlacementTools(connection) {
4
+ return [
5
+ {
6
+ tool: {
7
+ name: 'photoshop_place_image',
8
+ description: 'Place an image file as a layer in the active document',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ filePath: {
13
+ type: 'string',
14
+ description: 'Full path to the image file (JPEG, PNG, PSD, etc.)',
15
+ },
16
+ x: {
17
+ type: 'number',
18
+ description: 'X position offset in pixels (default: 0)',
19
+ default: 0,
20
+ },
21
+ y: {
22
+ type: 'number',
23
+ description: 'Y position offset in pixels (default: 0)',
24
+ default: 0,
25
+ },
26
+ },
27
+ required: ['filePath'],
28
+ },
29
+ },
30
+ handler: async (args) => placeImage(connection, args),
31
+ },
32
+ {
33
+ tool: {
34
+ name: 'photoshop_open_image',
35
+ description: 'Open an image file as a new document',
36
+ inputSchema: {
37
+ type: 'object',
38
+ properties: {
39
+ filePath: {
40
+ type: 'string',
41
+ description: 'Full path to the image file',
42
+ },
43
+ },
44
+ required: ['filePath'],
45
+ },
46
+ },
47
+ handler: async (args) => openImage(connection, args),
48
+ },
49
+ ];
50
+ }
51
+ async function placeImage(connection, args) {
52
+ const filePath = args.filePath;
53
+ const x = args.x || 0;
54
+ const y = args.y || 0;
55
+ try {
56
+ const apiFactory = new PhotoshopAPIFactory(connection);
57
+ const api = await apiFactory.createAPI();
58
+ const script = ExtendScriptSnippets.placeImage(filePath, x, y);
59
+ const result = await api.executeScript(script);
60
+ return {
61
+ content: [
62
+ {
63
+ type: 'text',
64
+ text: `Image placed successfully: ${filePath}\nPosition: (${x}, ${y})\nResult: ${JSON.stringify(result)}`,
65
+ },
66
+ ],
67
+ };
68
+ }
69
+ catch (error) {
70
+ return {
71
+ content: [
72
+ {
73
+ type: 'text',
74
+ text: `Error placing image: ${error instanceof Error ? error.message : String(error)}`,
75
+ },
76
+ ],
77
+ isError: true,
78
+ };
79
+ }
80
+ }
81
+ async function openImage(connection, args) {
82
+ const filePath = args.filePath;
83
+ try {
84
+ const apiFactory = new PhotoshopAPIFactory(connection);
85
+ const api = await apiFactory.createAPI();
86
+ const script = ExtendScriptSnippets.openImage(filePath);
87
+ const result = await api.executeScript(script);
88
+ return {
89
+ content: [
90
+ {
91
+ type: 'text',
92
+ text: `Image opened as new document: ${filePath}\nResult: ${JSON.stringify(result)}`,
93
+ },
94
+ ],
95
+ };
96
+ }
97
+ catch (error) {
98
+ return {
99
+ content: [
100
+ {
101
+ type: 'text',
102
+ text: `Error opening image: ${error instanceof Error ? error.message : String(error)}`,
103
+ },
104
+ ],
105
+ isError: true,
106
+ };
107
+ }
108
+ }
109
+ //# sourceMappingURL=image-placement-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-placement-tools.js","sourceRoot":"","sources":["../../src/tools/image-placement-tools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,UAAU,yBAAyB,CAAC,UAA+B;IACvE,OAAO;QACL;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,uBAAuB;gBAC7B,WAAW,EAAE,uDAAuD;gBACpE,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,oDAAoD;yBAClE;wBACD,CAAC,EAAE;4BACD,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,0CAA0C;4BACvD,OAAO,EAAE,CAAC;yBACX;wBACD,CAAC,EAAE;4BACD,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,0CAA0C;4BACvD,OAAO,EAAE,CAAC;yBACX;qBACF;oBACD,QAAQ,EAAE,CAAC,UAAU,CAAC;iBACvB;aACF;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC;SACtD;QACD;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,sBAAsB;gBAC5B,WAAW,EAAE,sCAAsC;gBACnD,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,6BAA6B;yBAC3C;qBACF;oBACD,QAAQ,EAAE,CAAC,UAAU,CAAC;iBACvB;aACF;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC;SACrD;KAC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MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,CAAC;QAEzC,MAAM,MAAM,GAAG,oBAAoB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxD,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAE/C,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,iCAAiC,QAAQ,aAAa,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;iBACrF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,wBAAwB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBACvF;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ToolDefinition } from '../core/tool-registry.js';
2
+ import { PhotoshopConnection } from '../platform/connection.js';
3
+ export declare function createImageTools(connection: PhotoshopConnection): ToolDefinition[];
4
+ //# sourceMappingURL=image-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-tools.d.ts","sourceRoot":"","sources":["../../src/tools/image-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAc,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,mBAAmB,GAAG,cAAc,EAAE,CA2DlF"}
@@ -0,0 +1,123 @@
1
+ import { PhotoshopAPIFactory } from '../api/photoshop-api.js';
2
+ import { ExtendScriptSnippets } from '../api/extendscript.js';
3
+ export function createImageTools(connection) {
4
+ return [
5
+ {
6
+ tool: {
7
+ name: 'photoshop_resize_image',
8
+ description: 'Resize the active image to specified dimensions',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ width: {
13
+ type: 'number',
14
+ description: 'New width in pixels',
15
+ minimum: 1,
16
+ },
17
+ height: {
18
+ type: 'number',
19
+ description: 'New height in pixels',
20
+ minimum: 1,
21
+ },
22
+ },
23
+ required: ['width', 'height'],
24
+ },
25
+ },
26
+ handler: async (args) => resizeImage(connection, args),
27
+ },
28
+ {
29
+ tool: {
30
+ name: 'photoshop_crop_document',
31
+ description: 'Crop the document to specified bounds',
32
+ inputSchema: {
33
+ type: 'object',
34
+ properties: {
35
+ left: {
36
+ type: 'number',
37
+ description: 'Left edge position in pixels',
38
+ minimum: 0,
39
+ },
40
+ top: {
41
+ type: 'number',
42
+ description: 'Top edge position in pixels',
43
+ minimum: 0,
44
+ },
45
+ right: {
46
+ type: 'number',
47
+ description: 'Right edge position in pixels',
48
+ minimum: 1,
49
+ },
50
+ bottom: {
51
+ type: 'number',
52
+ description: 'Bottom edge position in pixels',
53
+ minimum: 1,
54
+ },
55
+ },
56
+ required: ['left', 'top', 'right', 'bottom'],
57
+ },
58
+ },
59
+ handler: async (args) => cropDocument(connection, args),
60
+ },
61
+ ];
62
+ }
63
+ async function resizeImage(connection, args) {
64
+ const width = args.width;
65
+ const height = args.height;
66
+ try {
67
+ const apiFactory = new PhotoshopAPIFactory(connection);
68
+ const api = await apiFactory.createAPI();
69
+ const script = ExtendScriptSnippets.resizeImage(width, height);
70
+ await api.executeScript(script);
71
+ return {
72
+ content: [
73
+ {
74
+ type: 'text',
75
+ text: `Image resized to ${width}x${height}px`,
76
+ },
77
+ ],
78
+ };
79
+ }
80
+ catch (error) {
81
+ return {
82
+ content: [
83
+ {
84
+ type: 'text',
85
+ text: `Error resizing image: ${error instanceof Error ? error.message : String(error)}`,
86
+ },
87
+ ],
88
+ isError: true,
89
+ };
90
+ }
91
+ }
92
+ async function cropDocument(connection, args) {
93
+ const left = args.left;
94
+ const top = args.top;
95
+ const right = args.right;
96
+ const bottom = args.bottom;
97
+ try {
98
+ const apiFactory = new PhotoshopAPIFactory(connection);
99
+ const api = await apiFactory.createAPI();
100
+ const script = ExtendScriptSnippets.cropDocument(left, top, right, bottom);
101
+ const result = await api.executeScript(script);
102
+ return {
103
+ content: [
104
+ {
105
+ type: 'text',
106
+ text: `Document cropped\nResult: ${JSON.stringify(result)}`,
107
+ },
108
+ ],
109
+ };
110
+ }
111
+ catch (error) {
112
+ return {
113
+ content: [
114
+ {
115
+ type: 'text',
116
+ text: `Error cropping document: ${error instanceof Error ? error.message : String(error)}`,
117
+ },
118
+ ],
119
+ isError: true,
120
+ };
121
+ }
122
+ }
123
+ //# sourceMappingURL=image-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-tools.js","sourceRoot":"","sources":["../../src/tools/image-tools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,UAAU,gBAAgB,CAAC,UAA+B;IAC9D,OAAO;QACL;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,wBAAwB;gBAC9B,WAAW,EAAE,iDAAiD;gBAC9D,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,qBAAqB;4BAClC,OAAO,EAAE,CAAC;yBACX;wBACD,MAAM,EAAE;4BACN,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,sBAAsB;4BACnC,OAAO,EAAE,CAAC;yBACX;qBACF;oBACD,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;iBAC9B;aACF;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC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AAE,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBAC3F;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ToolDefinition } from '../core/tool-registry.js';
2
+ import { PhotoshopConnection } from '../platform/connection.js';
3
+ export declare function createLayerOrderingTools(connection: PhotoshopConnection): ToolDefinition[];
4
+ //# sourceMappingURL=layer-ordering-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-ordering-tools.d.ts","sourceRoot":"","sources":["../../src/tools/layer-ordering-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAc,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,mBAAmB,GAAG,cAAc,EAAE,CAqE1F"}