Skip to content

Commit 5e2f21a

Browse files
committed
Address PR feedback: merge get_component actions, rename settings to metadata
- Merge get_component_by_id and get_component_by_name into single get_component action - Rename get/set_component_settings to get/set_component_metadata - Update refine validator and error message
1 parent c5ebef0 commit 5e2f21a

1 file changed

Lines changed: 15 additions & 19 deletions

File tree

src/tools/deComponents.ts

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -183,27 +183,24 @@ export function registerDEComponentsTools(
183183
.describe(
184184
"Get all components, only valid if you are connected to Webflow Designer.",
185185
),
186-
get_component_by_id: z
186+
get_component: z
187187
.object({
188188
component_id: z
189189
.string()
190-
.describe("The id of the component to get"),
191-
})
192-
.optional()
193-
.describe("Get a component by its ID"),
194-
get_component_by_name: z
195-
.object({
190+
.optional()
191+
.describe("The id of the component to get. Use this or name."),
196192
name: z
197193
.string()
198-
.describe("The name of the component"),
194+
.optional()
195+
.describe("The name of the component. Use this or component_id."),
199196
group: z
200197
.string()
201198
.optional()
202-
.describe("Optional group to narrow the search"),
199+
.describe("Optional group to narrow the search when using name"),
203200
})
204201
.optional()
205202
.describe(
206-
"Get a component by its name, optionally within a specific group",
203+
"Get a component by ID or by name. Provide component_id for ID lookup, or name (and optional group) for name lookup.",
207204
),
208205
open_component_canvas: z
209206
.object({
@@ -215,17 +212,17 @@ export function registerDEComponentsTools(
215212
.describe(
216213
"Open the component canvas for editing a component directly",
217214
),
218-
get_component_settings: z
215+
get_component_metadata: z
219216
.object({
220217
component_id: z
221218
.string()
222219
.describe("The id of the component"),
223220
})
224221
.optional()
225222
.describe(
226-
"Get the settings (name, group, description) of a component",
223+
"Get the metadata (name, group, description) of a component",
227224
),
228-
set_component_settings: z
225+
set_component_metadata: z
229226
.object({
230227
component_id: z
231228
.string()
@@ -245,7 +242,7 @@ export function registerDEComponentsTools(
245242
})
246243
.optional()
247244
.describe(
248-
"Update settings (name, group, description) of a component",
245+
"Update metadata (name, group, description) of a component",
249246
),
250247
rename_component: z
251248
.object({
@@ -284,17 +281,16 @@ export function registerDEComponentsTools(
284281
d.open_component_view,
285282
d.close_component_view,
286283
d.get_all_components,
287-
d.get_component_by_id,
288-
d.get_component_by_name,
284+
d.get_component,
289285
d.open_component_canvas,
290-
d.get_component_settings,
291-
d.set_component_settings,
286+
d.get_component_metadata,
287+
d.set_component_metadata,
292288
d.rename_component,
293289
d.unregister_component,
294290
].filter(Boolean).length >= 1,
295291
{
296292
message:
297-
"Provide at least one of check_if_inside_component_view, transform_element_to_component, create_blank_component, insert_component_instance, open_component_view, close_component_view, get_all_components, get_component_by_id, get_component_by_name, open_component_canvas, get_component_settings, set_component_settings, rename_component, unregister_component.",
293+
"Provide at least one of check_if_inside_component_view, transform_element_to_component, create_blank_component, insert_component_instance, open_component_view, close_component_view, get_all_components, get_component, open_component_canvas, get_component_metadata, set_component_metadata, rename_component, unregister_component.",
298294
},
299295
),
300296
),

0 commit comments

Comments
 (0)