@clerk/agent-toolkit 0.0.7-snapshot.v20250310161610 → 0.0.7

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.
@@ -9,7 +9,7 @@ var API_URL = getEnvVariable("CLERK_API_URL") || apiUrlFromPublishableKey(PUBLIS
9
9
  var JWT_KEY = getEnvVariable("CLERK_JWT_KEY") || "";
10
10
  var SDK_METADATA = {
11
11
  name: "@clerk/agent-toolkit",
12
- version: "0.0.7-snapshot.v20250310161610",
12
+ version: "0.0.7",
13
13
  environment: getEnvVariable("NODE_ENV")
14
14
  };
15
15
  var clerkClient = createClerkClient({
@@ -17,28 +17,14 @@ var clerkClient = createClerkClient({
17
17
  apiUrl: API_URL,
18
18
  apiVersion: API_VERSION,
19
19
  jwtKey: JWT_KEY,
20
- userAgent: `${"@clerk/agent-toolkit"}@${"0.0.7-snapshot.v20250310161610"}`,
20
+ userAgent: `${"@clerk/agent-toolkit"}@${"0.0.7"}`,
21
21
  sdkMetadata: SDK_METADATA
22
22
  });
23
23
 
24
24
  // src/lib/constants.ts
25
- var defaultToolkitContext = {
26
- allowPrivateMetadata: false
27
- };
28
-
29
- // src/lib/inject-session-claims.ts
30
- var injectSessionClaims = (context) => (prompt) => {
31
- if (!context.sessionClaims && !context.userId) {
32
- return prompt;
33
- }
34
- const lines = [];
35
- lines.push(`# Signed-in user info:`);
36
- lines.push(
37
- context.sessionClaims?.sub || context.userId ? `Your userId is ${context.sessionClaims?.sub || context.userId}` : ""
38
- );
39
- lines.push(context.sessionClaims?.sid ? `Your sessionId is ${context.sessionClaims?.sid}` : "");
40
- lines.push(prompt);
41
- return lines.filter(Boolean).join("\n");
25
+ var defaultCreateClerkToolkitParams = {
26
+ allowPrivateMetadata: false,
27
+ clerkClient
42
28
  };
43
29
 
44
30
  // src/lib/utils.ts
@@ -61,15 +47,41 @@ var prunePrivateData = (context, o) => {
61
47
  }
62
48
  return o;
63
49
  };
50
+ var filterTools = (tools2, pattern) => {
51
+ if (!pattern || pattern.length === 0) {
52
+ throw new Error("No pattern specified");
53
+ }
54
+ if (pattern === "*") {
55
+ return Object.values(tools2).flatMap((category2) => Object.values(category2));
56
+ }
57
+ const validPattern = /^[a-zA-Z0-9_]+(\.[a-zA-Z0-9_*]+)?$/;
58
+ if (!validPattern.test(pattern)) {
59
+ throw new Error("Invalid pattern");
60
+ }
61
+ const [category, tool] = pattern.split(".");
62
+ if (!category || category && !tools2[category]) {
63
+ throw new Error(`Tool category not found: ${category}`);
64
+ }
65
+ if (category && tool === "*" || category && !tool) {
66
+ return Object.values(tools2[category]);
67
+ }
68
+ if (category && tool && !tools2[category][tool]) {
69
+ throw new Error(`Tool not found: ${tool}`);
70
+ }
71
+ return [tools2[category][tool]];
72
+ };
64
73
 
65
74
  // src/lib/tools/invitations.ts
66
- import { z } from "zod";
75
+ import { z as z2 } from "zod";
67
76
 
68
77
  // src/lib/clerk-tool.ts
78
+ import { z } from "zod";
69
79
  var trimLines = (text) => text.split("\n").map((l) => l.trim()).filter(Boolean).join("\n");
70
- var ClerkTool = (params) => {
71
- const schemaEntries = Object.entries(params.parameters.shape);
72
- const args = schemaEntries.length === 0 ? "Takes no arguments" : Object.entries(params.parameters.shape).map(([key, value]) => {
80
+ var ClerkTool = (_params) => {
81
+ const { execute, ...params } = _params;
82
+ const parameters = params.parameters ? params.parameters : z.object({});
83
+ const schemaEntries = Object.entries(parameters.shape);
84
+ const args = schemaEntries.length === 0 ? "Takes no arguments" : schemaEntries.map(([key, value]) => {
73
85
  return `- ${key}: ${value.description || ""}`;
74
86
  }).join("\n");
75
87
  const description = trimLines(`
@@ -80,7 +92,15 @@ var ClerkTool = (params) => {
80
92
  Arguments:
81
93
  ${args}
82
94
  `);
83
- return { ...params, description };
95
+ return {
96
+ ...params,
97
+ parameters,
98
+ description,
99
+ bindExecute: (clerkClient2, params2) => {
100
+ const toolContext = { ...params2.authContext, allowPrivateMetadata: params2.allowPrivateMetadata };
101
+ return execute(clerkClient2, toolContext);
102
+ }
103
+ };
84
104
  };
85
105
 
86
106
  // src/lib/tools/invitations.ts
@@ -98,14 +118,14 @@ var createInvitation = ClerkTool({
98
118
  2. Creating a closed registration system where only invited users can join
99
119
  3. Pre-configuring user attributes via publicMetadata before they sign up
100
120
  `,
101
- parameters: z.object({
102
- emailAddress: z.string().describe("(string): Email address to send the invitation to. Required."),
103
- redirectUrl: z.string().optional().describe("(string, optional): URL to redirect users to after they accept the invitation."),
104
- publicMetadata: z.record(z.string(), z.any()).optional().describe("(Record<string,any>, optional): Public metadata for the invitation."),
105
- notify: z.boolean().optional().describe("(boolean, optional): Whether to send an email notification. Defaults to true."),
106
- ignoreExisting: z.boolean().optional().describe("(boolean, optional): Whether to ignore if an invitation already exists. Defaults to false.")
121
+ parameters: z2.object({
122
+ emailAddress: z2.string().describe("(string): Email address to send the invitation to. Required."),
123
+ redirectUrl: z2.string().optional().describe("(string, optional): URL to redirect users to after they accept the invitation."),
124
+ publicMetadata: z2.record(z2.string(), z2.any()).optional().describe("(Record<string,any>, optional): Public metadata for the invitation."),
125
+ notify: z2.boolean().optional().describe("(boolean, optional): Whether to send an email notification. Defaults to true."),
126
+ ignoreExisting: z2.boolean().optional().describe("(boolean, optional): Whether to ignore if an invitation already exists. Defaults to false.")
107
127
  }),
108
- bindRunnable: (clerkClient2, context) => async (params) => {
128
+ execute: (clerkClient2, context) => async (params) => {
109
129
  const res = await clerkClient2.invitations.createInvitation(params);
110
130
  return prunePrivateData(context, res.raw);
111
131
  }
@@ -124,10 +144,10 @@ var revokeInvitation = ClerkTool({
124
144
  2. Revoking access when a prospective user should no longer be invited
125
145
  3. Implementing invitation management controls for administrators
126
146
  `,
127
- parameters: z.object({
128
- invitationId: z.string().describe("(string): The ID of the invitation to revoke. Required.")
147
+ parameters: z2.object({
148
+ invitationId: z2.string().describe("(string): The ID of the invitation to revoke. Required.")
129
149
  }),
130
- bindRunnable: (clerkClient2, context) => async (params) => {
150
+ execute: (clerkClient2, context) => async (params) => {
131
151
  const res = await clerkClient2.invitations.revokeInvitation(params.invitationId);
132
152
  return prunePrivateData(context, res.raw);
133
153
  }
@@ -138,7 +158,7 @@ var invitations = {
138
158
  };
139
159
 
140
160
  // src/lib/tools/organizations.ts
141
- import { z as z2 } from "zod";
161
+ import { z as z3 } from "zod";
142
162
  var getOrganization = ClerkTool({
143
163
  name: "getOrganization",
144
164
  description: `
@@ -152,20 +172,20 @@ var getOrganization = ClerkTool({
152
172
  2. Checking if an organization exists before performing operations on it
153
173
  3. Retrieving organization metadata for application-specific functionality
154
174
  `,
155
- parameters: z2.object({
156
- organizationId: z2.string().optional().describe("(string, optional): The ID of the organization to retrieve. Required if slug is not provided."),
157
- slug: z2.string().optional().describe(
175
+ parameters: z3.object({
176
+ organizationId: z3.string().optional().describe("(string, optional): The ID of the organization to retrieve. Required if slug is not provided."),
177
+ slug: z3.string().optional().describe(
158
178
  "(string, optional): The slug of the organization to retrieve. Required if organizationId is not provided."
159
179
  ),
160
- includeMembersCount: z2.boolean().optional().describe("(boolean, optional): Whether to include the members count for the organization.")
180
+ includeMembersCount: z3.boolean().optional().describe("(boolean, optional): Whether to include the members count for the organization.")
161
181
  }),
162
- bindRunnable: (clerkClient2, context) => async (params) => {
182
+ execute: (clerkClient2, context) => async (params) => {
163
183
  if (!params.organizationId && !params.slug) {
164
184
  throw new Error("Either organizationId or slug must be provided");
165
185
  }
166
186
  const res = await clerkClient2.organizations.getOrganization({
167
187
  ...params,
168
- organizationId: context.organizationId || params.organizationId
188
+ organizationId: context.orgId || params.organizationId
169
189
  });
170
190
  return prunePrivateData(context, res.raw);
171
191
  }
@@ -184,19 +204,19 @@ var createOrganization = ClerkTool({
184
204
  2. Building a self-service organization creation flow
185
205
  3. Migrating organizations from another system
186
206
  `,
187
- parameters: z2.object({
188
- name: z2.string().describe("(string): The name of the new organization. Required."),
189
- slug: z2.string().optional().describe(
207
+ parameters: z3.object({
208
+ name: z3.string().describe("(string): The name of the new organization. Required."),
209
+ slug: z3.string().optional().describe(
190
210
  "(string, optional): A URL-friendly identifier for the organization. If not provided, created from the name."
191
211
  ),
192
- createdBy: z2.string().optional().describe(
212
+ createdBy: z3.string().optional().describe(
193
213
  "(string, optional): The user ID of the user creating the organization. Defaults to the current authenticated user."
194
214
  ),
195
- maxAllowedMemberships: z2.number().optional().describe("(number, optional): Maximum number of members allowed in the organization."),
196
- publicMetadata: z2.record(z2.string(), z2.any()).optional().describe("(Record<string,any>, optional): Public metadata for the organization."),
197
- privateMetadata: z2.record(z2.string(), z2.any()).optional().describe("(Record<string,any>, optional): Private metadata for the organization (backend-only).")
215
+ maxAllowedMemberships: z3.number().optional().describe("(number, optional): Maximum number of members allowed in the organization."),
216
+ publicMetadata: z3.record(z3.string(), z3.any()).optional().describe("(Record<string,any>, optional): Public metadata for the organization."),
217
+ privateMetadata: z3.record(z3.string(), z3.any()).optional().describe("(Record<string,any>, optional): Private metadata for the organization (backend-only).")
198
218
  }),
199
- bindRunnable: (clerkClient2, context) => async (params) => {
219
+ execute: (clerkClient2, context) => async (params) => {
200
220
  const { createdBy, ...createParams } = params;
201
221
  const createParamsWithUser = createdBy || context.userId ? { ...createParams, createdBy: createdBy || context.userId } : createParams;
202
222
  const res = await clerkClient2.organizations.createOrganization(createParamsWithUser);
@@ -217,20 +237,17 @@ var updateOrganization = ClerkTool({
217
237
  2. Changing the maximum allowed memberships
218
238
  3. Updating multiple organization attributes at once
219
239
  `,
220
- parameters: z2.object({
221
- organizationId: z2.string().describe("(string): The ID of the organization to update. Required."),
222
- name: z2.string().optional().describe("(string, optional): New name for the organization."),
223
- slug: z2.string().optional().describe("(string, optional): New slug for the organization."),
224
- maxAllowedMemberships: z2.number().optional().describe("(number, optional): New maximum number of members allowed."),
225
- publicMetadata: z2.record(z2.string(), z2.any()).optional().describe("(Record<string,any>, optional): New public metadata for the organization."),
226
- privateMetadata: z2.record(z2.string(), z2.any()).optional().describe("(Record<string,any>, optional): New private metadata for the organization (backend-only).")
240
+ parameters: z3.object({
241
+ organizationId: z3.string().describe("(string): The ID of the organization to update. Required."),
242
+ name: z3.string().optional().describe("(string, optional): New name for the organization."),
243
+ slug: z3.string().optional().describe("(string, optional): New slug for the organization."),
244
+ maxAllowedMemberships: z3.number().optional().describe("(number, optional): New maximum number of members allowed."),
245
+ publicMetadata: z3.record(z3.string(), z3.any()).optional().describe("(Record<string,any>, optional): New public metadata for the organization."),
246
+ privateMetadata: z3.record(z3.string(), z3.any()).optional().describe("(Record<string,any>, optional): New private metadata for the organization (backend-only).")
227
247
  }),
228
- bindRunnable: (clerkClient2, context) => async (params) => {
248
+ execute: (clerkClient2, context) => async (params) => {
229
249
  const { organizationId, ...updateParams } = params;
230
- const res = await clerkClient2.organizations.updateOrganization(
231
- context.organizationId || organizationId,
232
- updateParams
233
- );
250
+ const res = await clerkClient2.organizations.updateOrganization(context.orgId || organizationId, updateParams);
234
251
  return prunePrivateData(context, res.raw);
235
252
  }
236
253
  });
@@ -251,19 +268,19 @@ var updateOrganizationMetadata = ClerkTool({
251
268
  2. Keeping track of organization-specific application state
252
269
  3. Adding custom attributes to organizations
253
270
  `,
254
- parameters: z2.object({
255
- organizationId: z2.string().describe("(string): The ID of the organization to update. Required."),
256
- publicMetadata: z2.record(z2.string(), z2.any()).optional().describe(
271
+ parameters: z3.object({
272
+ organizationId: z3.string().describe("(string): The ID of the organization to update. Required."),
273
+ publicMetadata: z3.record(z3.string(), z3.any()).optional().describe(
257
274
  "(Record<string,any>, optional): The public metadata to set or update. Use null values to remove specific keys."
258
275
  ),
259
- privateMetadata: z2.record(z2.string(), z2.any()).optional().describe(
276
+ privateMetadata: z3.record(z3.string(), z3.any()).optional().describe(
260
277
  "(Record<string,any>, optional): The private metadata to set or update. Backend-only data. Use null values to remove specific keys."
261
278
  )
262
279
  }),
263
- bindRunnable: (clerkClient2, context) => async (params) => {
280
+ execute: (clerkClient2, context) => async (params) => {
264
281
  const { organizationId, ...metadataParams } = params;
265
282
  const res = await clerkClient2.organizations.updateOrganizationMetadata(
266
- context.organizationId || organizationId,
283
+ context.orgId || organizationId,
267
284
  metadataParams
268
285
  );
269
286
  return prunePrivateData(context, res.raw);
@@ -283,11 +300,11 @@ var deleteOrganization = ClerkTool({
283
300
  2. Allowing users to delete their own organizations
284
301
  3. Administrative operations to remove unwanted organizations
285
302
  `,
286
- parameters: z2.object({
287
- organizationId: z2.string().describe("(string): The ID of the organization to delete. Required.")
303
+ parameters: z3.object({
304
+ organizationId: z3.string().describe("(string): The ID of the organization to delete. Required.")
288
305
  }),
289
- bindRunnable: (clerkClient2, context) => async (params) => {
290
- const res = await clerkClient2.organizations.deleteOrganization(context.organizationId || params.organizationId);
306
+ execute: (clerkClient2, context) => async (params) => {
307
+ const res = await clerkClient2.organizations.deleteOrganization(context.orgId || params.organizationId);
291
308
  return prunePrivateData(context, res.raw);
292
309
  }
293
310
  });
@@ -305,15 +322,15 @@ var createOrganizationMembership = ClerkTool({
305
322
  2. Building administrative interfaces for member management
306
323
  3. Migrating memberships from another system
307
324
  `,
308
- parameters: z2.object({
309
- organizationId: z2.string().describe("(string): The ID of the organization to add the member to. Required."),
310
- userId: z2.string().describe("(string): The ID of the user to add as a member. Required."),
311
- role: z2.string().describe("(string): The role to assign to the user in the organization. Required.")
325
+ parameters: z3.object({
326
+ organizationId: z3.string().describe("(string): The ID of the organization to add the member to. Required."),
327
+ userId: z3.string().describe("(string): The ID of the user to add as a member. Required."),
328
+ role: z3.string().describe("(string): The role to assign to the user in the organization. Required.")
312
329
  }),
313
- bindRunnable: (clerkClient2, context) => async (params) => {
330
+ execute: (clerkClient2, context) => async (params) => {
314
331
  const res = await clerkClient2.organizations.createOrganizationMembership({
315
332
  ...params,
316
- organizationId: context.organizationId || params.organizationId,
333
+ organizationId: context.orgId || params.organizationId,
317
334
  userId: context.userId || params.userId
318
335
  });
319
336
  return prunePrivateData(context, res.raw);
@@ -333,15 +350,15 @@ var updateOrganizationMembership = ClerkTool({
333
350
  2. Building role management interfaces
334
351
  3. Implementing admin-level controls for organization management
335
352
  `,
336
- parameters: z2.object({
337
- organizationId: z2.string().describe("(string): The ID of the organization containing the membership. Required."),
338
- userId: z2.string().describe("(string): The ID of the user whose membership is being updated. Required."),
339
- role: z2.string().describe("(string): The new role to assign to the user. Required.")
353
+ parameters: z3.object({
354
+ organizationId: z3.string().describe("(string): The ID of the organization containing the membership. Required."),
355
+ userId: z3.string().describe("(string): The ID of the user whose membership is being updated. Required."),
356
+ role: z3.string().describe("(string): The new role to assign to the user. Required.")
340
357
  }),
341
- bindRunnable: (clerkClient2, context) => async (params) => {
358
+ execute: (clerkClient2, context) => async (params) => {
342
359
  const res = await clerkClient2.organizations.updateOrganizationMembership({
343
360
  ...params,
344
- organizationId: context.organizationId || params.organizationId
361
+ organizationId: context.orgId || params.organizationId
345
362
  });
346
363
  return prunePrivateData(context, res.raw);
347
364
  }
@@ -363,20 +380,20 @@ var updateOrganizationMembershipMetadata = ClerkTool({
363
380
  2. Adding custom attributes to track member activity or status
364
381
  3. Customizing a user's experience within a specific organization
365
382
  `,
366
- parameters: z2.object({
367
- organizationId: z2.string().describe("(string): The ID of the organization containing the membership. Required."),
368
- userId: z2.string().describe("(string): The ID of the user whose membership metadata is being updated. Required."),
369
- publicMetadata: z2.record(z2.string(), z2.any()).optional().describe(
383
+ parameters: z3.object({
384
+ organizationId: z3.string().describe("(string): The ID of the organization containing the membership. Required."),
385
+ userId: z3.string().describe("(string): The ID of the user whose membership metadata is being updated. Required."),
386
+ publicMetadata: z3.record(z3.string(), z3.any()).optional().describe(
370
387
  "(Record<string,any>, optional): The public metadata to set or update. Use null values to remove specific keys."
371
388
  ),
372
- privateMetadata: z2.record(z2.string(), z2.any()).optional().describe(
389
+ privateMetadata: z3.record(z3.string(), z3.any()).optional().describe(
373
390
  "(Record<string,any>, optional): The private metadata to set or update. Backend-only data. Use null values to remove specific keys."
374
391
  )
375
392
  }),
376
- bindRunnable: (clerkClient2, context) => async (params) => {
393
+ execute: (clerkClient2, context) => async (params) => {
377
394
  const res = await clerkClient2.organizations.updateOrganizationMembershipMetadata({
378
395
  ...params,
379
- organizationId: context.organizationId || params.organizationId
396
+ organizationId: context.orgId || params.organizationId
380
397
  });
381
398
  return prunePrivateData(context, res.raw);
382
399
  }
@@ -395,11 +412,11 @@ var deleteOrganizationMembership = ClerkTool({
395
412
  2. Building membership management interfaces with removal capability
396
413
  3. Implementing self-service leave organization functionality
397
414
  `,
398
- parameters: z2.object({
399
- organizationId: z2.string().describe("(string): The ID of the organization to remove the member from. Required."),
400
- userId: z2.string().describe("(string): The ID of the user to remove from the organization. Required.")
415
+ parameters: z3.object({
416
+ organizationId: z3.string().describe("(string): The ID of the organization to remove the member from. Required."),
417
+ userId: z3.string().describe("(string): The ID of the user to remove from the organization. Required.")
401
418
  }),
402
- bindRunnable: (clerkClient2, context) => async (params) => {
419
+ execute: (clerkClient2, context) => async (params) => {
403
420
  const res = await clerkClient2.organizations.deleteOrganizationMembership({
404
421
  ...params,
405
422
  userId: context.userId || params.userId
@@ -421,17 +438,17 @@ var createOrganizationInvitation = ClerkTool({
421
438
  2. Implementing team expansion functionality
422
439
  3. Creating administrative tools for organization growth
423
440
  `,
424
- parameters: z2.object({
425
- organizationId: z2.string().describe("(string): The ID of the organization to create an invitation for. Required."),
426
- emailAddress: z2.string().describe("(string): Email address to send the invitation to. Required."),
427
- role: z2.string().describe("(string): Role to assign to the user upon accepting the invitation. Required."),
428
- inviterUserId: z2.string().optional().describe(
441
+ parameters: z3.object({
442
+ organizationId: z3.string().describe("(string): The ID of the organization to create an invitation for. Required."),
443
+ emailAddress: z3.string().describe("(string): Email address to send the invitation to. Required."),
444
+ role: z3.string().describe("(string): Role to assign to the user upon accepting the invitation. Required."),
445
+ inviterUserId: z3.string().optional().describe(
429
446
  "(string, optional): User ID of the person sending the invitation. Defaults to the current authenticated user."
430
447
  ),
431
- redirectUrl: z2.string().optional().describe("(string, optional): URL to redirect users to after they accept the invitation."),
432
- publicMetadata: z2.record(z2.string(), z2.any()).optional().describe("(Record<string,any>, optional): Public metadata for the invitation.")
448
+ redirectUrl: z3.string().optional().describe("(string, optional): URL to redirect users to after they accept the invitation."),
449
+ publicMetadata: z3.record(z3.string(), z3.any()).optional().describe("(Record<string,any>, optional): Public metadata for the invitation.")
433
450
  }),
434
- bindRunnable: (clerkClient2, context) => async (params) => {
451
+ execute: (clerkClient2, context) => async (params) => {
435
452
  const { inviterUserId, ...inviteParams } = params;
436
453
  const inviteParamsWithUser = inviterUserId || context.userId ? { ...inviteParams, inviterUserId: inviterUserId || context.userId } : inviteParams;
437
454
  const res = await clerkClient2.organizations.createOrganizationInvitation(inviteParamsWithUser);
@@ -452,14 +469,14 @@ var revokeOrganizationInvitation = ClerkTool({
452
469
  2. Building invitation management interfaces with revocation capability
453
470
  3. Implementing security measures to quickly revoke access
454
471
  `,
455
- parameters: z2.object({
456
- organizationId: z2.string().describe("(string): The ID of the organization containing the invitation. Required."),
457
- invitationId: z2.string().describe("(string): The ID of the invitation to revoke. Required."),
458
- requestingUserId: z2.string().optional().describe(
472
+ parameters: z3.object({
473
+ organizationId: z3.string().describe("(string): The ID of the organization containing the invitation. Required."),
474
+ invitationId: z3.string().describe("(string): The ID of the invitation to revoke. Required."),
475
+ requestingUserId: z3.string().optional().describe(
459
476
  "(string, optional): User ID of the person revoking the invitation. Defaults to the current authenticated user."
460
477
  )
461
478
  }),
462
- bindRunnable: (clerkClient2, context) => async (params) => {
479
+ execute: (clerkClient2, context) => async (params) => {
463
480
  const { requestingUserId, ...revokeParams } = params;
464
481
  const revokeParamsWithUser = requestingUserId || context.userId ? { ...revokeParams, requestingUserId: requestingUserId || context.userId } : revokeParams;
465
482
  const res = await clerkClient2.organizations.revokeOrganizationInvitation(revokeParamsWithUser);
@@ -480,8 +497,8 @@ var organizations = {
480
497
  revokeOrganizationInvitation
481
498
  };
482
499
 
483
- // src/lib/tools/user.ts
484
- import { z as z3 } from "zod";
500
+ // src/lib/tools/users.ts
501
+ import { z as z4 } from "zod";
485
502
  var getUserId = ClerkTool({
486
503
  name: "getUserId",
487
504
  description: `
@@ -490,8 +507,8 @@ var getUserId = ClerkTool({
490
507
  This tool takes no parameters and is the quickest way to check if a user is authenticated.
491
508
  Example use case: When you need to verify if a user is logged in before performing user-specific operations.
492
509
  `,
493
- parameters: z3.object({}),
494
- bindRunnable: (clerkClient2, context) => () => {
510
+ parameters: z4.object({}),
511
+ execute: (clerkClient2, context) => () => {
495
512
  return Promise.resolve(context.userId || null);
496
513
  }
497
514
  });
@@ -504,10 +521,10 @@ var getUser = ClerkTool({
504
521
  If the userId parameter is not provided, it will use the current authenticated user's ID.
505
522
  Example use case: When you need to display user profile information or check user attributes.
506
523
  `,
507
- parameters: z3.object({
508
- userId: z3.string().describe("(string): The userId of the User to retrieve.")
524
+ parameters: z4.object({
525
+ userId: z4.string().describe("(string): The userId of the User to retrieve.")
509
526
  }),
510
- bindRunnable: (clerkClient2, context) => async (params) => {
527
+ execute: (clerkClient2, context) => async (params) => {
511
528
  const res = await clerkClient2.users.getUser(context.userId || params.userId);
512
529
  return prunePrivateData(context, res.raw);
513
530
  }
@@ -519,8 +536,8 @@ var getUserCount = ClerkTool({
519
536
  Use this tool when you need to know the total number of users in the system.
520
537
  This tool takes no parameters and is an efficient way to get just the count without retrieving user details.
521
538
  `,
522
- parameters: z3.object({}),
523
- bindRunnable: (clerkClient2, _) => async () => {
539
+ parameters: z4.object({}),
540
+ execute: (clerkClient2, _) => async () => {
524
541
  return await clerkClient2.users.getCount();
525
542
  }
526
543
  });
@@ -537,11 +554,11 @@ var updateUserPublicMetadata = ClerkTool({
537
554
 
538
555
  Example use case: Storing user preferences, feature flags, or application-specific data that persists across sessions.
539
556
  `,
540
- parameters: z3.object({
541
- userId: z3.string().describe("(string): The userId of the User to update."),
542
- metadata: z3.record(z3.string(), z3.any()).describe("(Record<string,any>): The public metadata to set or update. Use null values to remove specific keys.")
557
+ parameters: z4.object({
558
+ userId: z4.string().describe("(string): The userId of the User to update."),
559
+ metadata: z4.record(z4.string(), z4.any()).describe("(Record<string,any>): The public metadata to set or update. Use null values to remove specific keys.")
543
560
  }),
544
- bindRunnable: (clerkClient2, context) => async (params) => {
561
+ execute: (clerkClient2, context) => async (params) => {
545
562
  const { userId, metadata } = params;
546
563
  const res = await clerkClient2.users.updateUserMetadata(context.userId || userId, { publicMetadata: metadata });
547
564
  return prunePrivateData(context, res.raw);
@@ -561,11 +578,11 @@ var updateUserUnsafeMetadata = ClerkTool({
561
578
 
562
579
  Example use case: Storing user data that should be modifiable from the frontend but not included in authentication tokens.
563
580
  `,
564
- parameters: z3.object({
565
- userId: z3.string().describe("(string): The userId of the User to update."),
566
- metadata: z3.record(z3.string(), z3.any()).describe("(Record<string,any>): The unsafe metadata to set or update. Use null values to remove specific keys.")
581
+ parameters: z4.object({
582
+ userId: z4.string().describe("(string): The userId of the User to update."),
583
+ metadata: z4.record(z4.string(), z4.any()).describe("(Record<string,any>): The unsafe metadata to set or update. Use null values to remove specific keys.")
567
584
  }),
568
- bindRunnable: (clerkClient2, context) => async (params) => {
585
+ execute: (clerkClient2, context) => async (params) => {
569
586
  const { userId, metadata } = params;
570
587
  const res = await clerkClient2.users.updateUserMetadata(context.userId || userId, { unsafeMetadata: metadata });
571
588
  return prunePrivateData(context, res.raw);
@@ -588,14 +605,14 @@ var updateUser = ClerkTool({
588
605
  2. Enabling or disabling a user account
589
606
  3. Setting a user's primary contact information
590
607
  `,
591
- parameters: z3.object({
592
- userId: z3.string().describe("(string): The userId of the User to update."),
593
- firstName: z3.string().optional().describe("(string): New first name for the user"),
594
- lastName: z3.string().optional().describe("(string): New last name for the user"),
595
- username: z3.string().optional().describe("(string): New username for the user"),
596
- profileImageUrl: z3.string().optional().describe("(string): URL for the user profile image")
608
+ parameters: z4.object({
609
+ userId: z4.string().describe("(string): The userId of the User to update."),
610
+ firstName: z4.string().optional().describe("(string): New first name for the user"),
611
+ lastName: z4.string().optional().describe("(string): New last name for the user"),
612
+ username: z4.string().optional().describe("(string): New username for the user"),
613
+ profileImageUrl: z4.string().optional().describe("(string): URL for the user profile image")
597
614
  }),
598
- bindRunnable: (clerkClient2, context) => async (params) => {
615
+ execute: (clerkClient2, context) => async (params) => {
599
616
  const { userId, ...updateParams } = params;
600
617
  const res = await clerkClient2.users.updateUser(context.userId || userId, updateParams);
601
618
  return prunePrivateData(context, res.raw);
@@ -638,11 +655,10 @@ var flatTools = {
638
655
  };
639
656
 
640
657
  export {
641
- clerkClient,
642
- defaultToolkitContext,
643
- injectSessionClaims,
658
+ defaultCreateClerkToolkitParams,
644
659
  shallowTransform,
660
+ filterTools,
645
661
  tools,
646
662
  flatTools
647
663
  };
648
- //# sourceMappingURL=chunk-SEOMNBNU.js.map
664
+ //# sourceMappingURL=chunk-G2DZO54M.js.map