@seed-design/mcp 1.1.10 → 1.1.11
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/bin/index.mjs +3 -3
- package/package.json +1 -1
- package/src/responses.ts +6 -19
- package/src/tools.ts +4 -4
package/bin/index.mjs
CHANGED
|
@@ -481,7 +481,7 @@ function registerTools(server, figmaClient, config = {}) {
|
|
|
481
481
|
scale: scale || 1
|
|
482
482
|
});
|
|
483
483
|
const typedResult = result;
|
|
484
|
-
return formatImageResponse(typedResult.
|
|
484
|
+
return formatImageResponse(typedResult.base64, typedResult.mimeType || "image/png");
|
|
485
485
|
} catch (error) {
|
|
486
486
|
return formatErrorResponse("export_node_as_image", error);
|
|
487
487
|
}
|
|
@@ -518,7 +518,7 @@ function registerEditingTools(server, figmaClient) {
|
|
|
518
518
|
y
|
|
519
519
|
});
|
|
520
520
|
const typedResult = result;
|
|
521
|
-
return formatTextResponse(`Cloned node
|
|
521
|
+
return formatTextResponse(`Cloned node with new ID: ${typedResult.id}${x !== undefined && y !== undefined ? ` at position (${x}, ${y})` : ""}`);
|
|
522
522
|
} catch (error) {
|
|
523
523
|
return formatErrorResponse("clone_node", error);
|
|
524
524
|
}
|
|
@@ -678,7 +678,7 @@ function registerPrompts(server) {
|
|
|
678
678
|
});
|
|
679
679
|
}
|
|
680
680
|
|
|
681
|
-
var version = "1.1.
|
|
681
|
+
var version = "1.1.11";
|
|
682
682
|
|
|
683
683
|
// Config loader
|
|
684
684
|
async function loadConfig(configPath) {
|
package/package.json
CHANGED
package/src/responses.ts
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
1
2
|
import { formatError } from "./logger";
|
|
2
3
|
|
|
3
|
-
/**
|
|
4
|
-
* Helper type for a tool response content item
|
|
5
|
-
*/
|
|
6
|
-
export type ContentItem =
|
|
7
|
-
| { type: "text"; text: string }
|
|
8
|
-
| { type: "image"; data: string; mimeType: string };
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Helper type for a tool response
|
|
12
|
-
*/
|
|
13
|
-
export type ToolResponse = {
|
|
14
|
-
content: ContentItem[];
|
|
15
|
-
};
|
|
16
|
-
|
|
17
4
|
/**
|
|
18
5
|
* Format an object response
|
|
19
6
|
*/
|
|
20
|
-
export function formatObjectResponse(result: unknown):
|
|
7
|
+
export function formatObjectResponse(result: unknown): CallToolResult {
|
|
21
8
|
return {
|
|
22
9
|
content: [
|
|
23
10
|
{
|
|
@@ -31,7 +18,7 @@ export function formatObjectResponse(result: unknown): ToolResponse {
|
|
|
31
18
|
/**
|
|
32
19
|
* Format a text response
|
|
33
20
|
*/
|
|
34
|
-
export function formatTextResponse(text: string):
|
|
21
|
+
export function formatTextResponse(text: string): CallToolResult {
|
|
35
22
|
return {
|
|
36
23
|
content: [
|
|
37
24
|
{
|
|
@@ -45,7 +32,7 @@ export function formatTextResponse(text: string): ToolResponse {
|
|
|
45
32
|
/**
|
|
46
33
|
* Format an image response
|
|
47
34
|
*/
|
|
48
|
-
export function formatImageResponse(imageData: string, mimeType = "image/png"):
|
|
35
|
+
export function formatImageResponse(imageData: string, mimeType = "image/png"): CallToolResult {
|
|
49
36
|
return {
|
|
50
37
|
content: [
|
|
51
38
|
{
|
|
@@ -60,7 +47,7 @@ export function formatImageResponse(imageData: string, mimeType = "image/png"):
|
|
|
60
47
|
/**
|
|
61
48
|
* Format an error response
|
|
62
49
|
*/
|
|
63
|
-
export function formatErrorResponse(toolName: string, error: unknown):
|
|
50
|
+
export function formatErrorResponse(toolName: string, error: unknown): CallToolResult {
|
|
64
51
|
return {
|
|
65
52
|
content: [
|
|
66
53
|
{
|
|
@@ -74,7 +61,7 @@ export function formatErrorResponse(toolName: string, error: unknown): ToolRespo
|
|
|
74
61
|
/**
|
|
75
62
|
* Format a progress response with initial message
|
|
76
63
|
*/
|
|
77
|
-
export function formatProgressResponse(initialMessage: string, result: unknown):
|
|
64
|
+
export function formatProgressResponse(initialMessage: string, result: unknown): CallToolResult {
|
|
78
65
|
return {
|
|
79
66
|
content: [
|
|
80
67
|
{
|
package/src/tools.ts
CHANGED
|
@@ -302,8 +302,8 @@ export function registerTools(
|
|
|
302
302
|
format: format || "PNG",
|
|
303
303
|
scale: scale || 1,
|
|
304
304
|
});
|
|
305
|
-
const typedResult = result as {
|
|
306
|
-
return formatImageResponse(typedResult.
|
|
305
|
+
const typedResult = result as { base64: string; mimeType: string };
|
|
306
|
+
return formatImageResponse(typedResult.base64, typedResult.mimeType || "image/png");
|
|
307
307
|
} catch (error) {
|
|
308
308
|
return formatErrorResponse("export_node_as_image", error);
|
|
309
309
|
}
|
|
@@ -346,9 +346,9 @@ export function registerEditingTools(server: McpServer, figmaClient: FigmaWebSoc
|
|
|
346
346
|
async ({ nodeId, x, y }) => {
|
|
347
347
|
try {
|
|
348
348
|
const result = await sendCommandToFigma("clone_node", { nodeId, x, y });
|
|
349
|
-
const typedResult = result as {
|
|
349
|
+
const typedResult = result as { id: string; originalId: string; x?: number; y?: number; success: boolean };
|
|
350
350
|
return formatTextResponse(
|
|
351
|
-
`Cloned node
|
|
351
|
+
`Cloned node with new ID: ${typedResult.id}${x !== undefined && y !== undefined ? ` at position (${x}, ${y})` : ""}`,
|
|
352
352
|
);
|
|
353
353
|
} catch (error) {
|
|
354
354
|
return formatErrorResponse("clone_node", error);
|