@ject-5-fe/figma-plugin 0.1.3 → 0.1.5
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/server/server.cjs +33 -20
- package/package.json +1 -1
package/dist/server/server.cjs
CHANGED
|
@@ -98,31 +98,44 @@ server.tool(
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
|
+
server.registerResource(
|
|
102
|
+
"figma-selection",
|
|
103
|
+
new import_mcp.ResourceTemplate("figma://selection/{sessionId}", { list: void 0 }),
|
|
104
|
+
{
|
|
105
|
+
title: "Figma Selection Result",
|
|
106
|
+
description: "Stores the full Figma selection data when it's too large to return inline"
|
|
107
|
+
},
|
|
108
|
+
async (uri) => {
|
|
109
|
+
const result = await sendCommandToFigma("get_selection");
|
|
110
|
+
return {
|
|
111
|
+
contents: [
|
|
112
|
+
{
|
|
113
|
+
uri: uri.href,
|
|
114
|
+
mimeType: "application/json",
|
|
115
|
+
text: typeof result === "string" ? result : JSON.stringify(result, null, 2)
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
);
|
|
101
121
|
server.tool(
|
|
102
122
|
"get_selection",
|
|
103
123
|
"Get information about the current selection in Figma",
|
|
104
124
|
{},
|
|
105
125
|
async () => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
{
|
|
120
|
-
type: "text",
|
|
121
|
-
text: `Error getting selection: ${error instanceof Error ? error.message : String(error)}`
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
+
const resourceUri = "figma://selection/current";
|
|
127
|
+
return {
|
|
128
|
+
content: [
|
|
129
|
+
{
|
|
130
|
+
// 큰 데이터를 안 넣고, 링크만 넘겨줍니다
|
|
131
|
+
type: "resource_link",
|
|
132
|
+
uri: resourceUri,
|
|
133
|
+
name: "Current Figma Selection",
|
|
134
|
+
mimeType: "application/json",
|
|
135
|
+
description: "Full raw selection JSON from Figma"
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
};
|
|
126
139
|
}
|
|
127
140
|
);
|
|
128
141
|
server.tool(
|