@signalhousellc/sdk 1.0.65 → 1.0.67

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.
@@ -0,0 +1,456 @@
1
+ /**
2
+ * @typedef {Object} CreateAgentProfileData
3
+ * @property {string} groupId - The parent group id (at least 8 characters, starts with 'G').
4
+ * @property {string|null} [subgroupId] - Optional subgroup id (at least 8 characters, starts with 'S'); null/omitted = group-level agent.
5
+ * @property {string} name - The agent's name (required).
6
+ * @property {string} [status] - Lifecycle status: "active" or "inactive" (defaults to "active").
7
+ * @property {string} [systemPrompt] - Base system prompt composed into every conversation.
8
+ * @property {string} [greeting] - Opening line the agent leads with.
9
+ * @property {string} [guardrails] - Freeform guardrail instructions appended to the composed prompt.
10
+ * @property {string|null} [voiceId] - ElevenLabs voice id for the voice channel; null until set.
11
+ * @property {string} [llmProvider] - LLM backend: "bedrock", "openai", "anthropic", or "groq" (defaults to "bedrock").
12
+ * @property {string|null} [llmModel] - Concrete model id for the provider; null = provider default.
13
+ * @property {number} [temperature] - Sampling temperature (0-2).
14
+ */
15
+
16
+ /**
17
+ * @typedef {Object} UpdateAgentProfileData
18
+ * @property {string} [name] - The agent's name.
19
+ * @property {string} [status] - Lifecycle status: "active" or "inactive".
20
+ * @property {string} [systemPrompt] - Base system prompt composed into every conversation.
21
+ * @property {string} [greeting] - Opening line the agent leads with.
22
+ * @property {string} [guardrails] - Freeform guardrail instructions appended to the composed prompt.
23
+ * @property {string|null} [voiceId] - ElevenLabs voice id for the voice channel.
24
+ * @property {string} [llmProvider] - LLM backend: "bedrock", "openai", "anthropic", or "groq".
25
+ * @property {string|null} [llmModel] - Concrete model id for the provider; null = provider default.
26
+ * @property {number} [temperature] - Sampling temperature (0-2).
27
+ */
28
+
29
+ export class Agents {
30
+ constructor(client, enableAdmin) {
31
+ this.client = client;
32
+ this.enableAdmin = enableAdmin;
33
+ }
34
+
35
+ /**
36
+ * List the agent profiles under a group.
37
+ * @async
38
+ * @roles api, admin, developer, billing, user
39
+ * @param {Object} params - The parameters for listing agent profiles.
40
+ * @param {string} params.groupId - The group whose profiles to list (required).
41
+ * @param {number} [params.page] - The page number for pagination.
42
+ * @param {number} [params.limit] - The number of items per page for pagination.
43
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
44
+ * @throws {Error} Throws an error if the groupId parameter is missing.
45
+ * @returns {Promise<Object>} - The list of agent profiles returned from the server.
46
+ */
47
+ async getAgentProfiles({ groupId, page, limit, options = {} }) {
48
+ this.client._require({ groupId });
49
+ const queryString = this.client._getQueryString({ groupId, page, limit });
50
+ return this.client(`/agent/profiles${queryString}`, { method: "GET", ...options });
51
+ }
52
+
53
+ /**
54
+ * Get a single agent profile by id.
55
+ * @async
56
+ * @roles api, admin, developer, billing, user
57
+ * @param {Object} params - The parameters for getting an agent profile.
58
+ * @param {string} params.agentProfileId - The id of the agent profile to fetch.
59
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
60
+ * @throws {Error} Throws an error if the agentProfileId parameter is missing.
61
+ * @returns {Promise<Object>} - The agent profile returned from the server.
62
+ */
63
+ async getAgentProfile({ agentProfileId, options = {} }) {
64
+ this.client._require({ agentProfileId });
65
+ const safeId = encodeURIComponent(agentProfileId);
66
+ return this.client(`/agent/profiles/${safeId}`, { method: "GET", ...options });
67
+ }
68
+
69
+ /**
70
+ * Create a new agent profile.
71
+ * @async
72
+ * @roles api, admin, developer
73
+ * @param {Object} params - The parameters for creating an agent profile (see CreateAgentProfileData typedef).
74
+ * @param {CreateAgentProfileData} params.profileData - The data for the agent profile to create, including required fields groupId and name.
75
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
76
+ * @throws {Error} Throws an error if the profileData parameter is missing.
77
+ * @returns {Promise<Object>} - The created agent profile returned from the server.
78
+ */
79
+ async createAgentProfile({ profileData, options = {} }) {
80
+ this.client._require({ profileData });
81
+ return this.client(`/agent/profiles`, { method: "POST", body: profileData, ...options });
82
+ }
83
+
84
+ /**
85
+ * Update an existing agent profile.
86
+ * @async
87
+ * @roles api, admin, developer
88
+ * @param {Object} params - The parameters for updating an agent profile (see UpdateAgentProfileData typedef).
89
+ * @param {string} params.id - The id of the agent profile to update.
90
+ * @param {UpdateAgentProfileData} params.updateData - The data for the agent profile to update.
91
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
92
+ * @throws {Error} Throws an error if the id or updateData parameter is missing.
93
+ * @returns {Promise<Object>} - The updated agent profile returned from the server.
94
+ */
95
+ async updateAgentProfile({ id, updateData, options = {} }) {
96
+ this.client._require({ id, updateData });
97
+ const safeId = encodeURIComponent(id);
98
+ return this.client(`/agent/profiles/${safeId}`, { method: "PUT", body: updateData, ...options });
99
+ }
100
+
101
+ /**
102
+ * Delete (inactivate) an agent profile by its id.
103
+ * @async
104
+ * @roles api, admin, developer
105
+ * @param {Object} params - The parameters for deleting an agent profile.
106
+ * @param {string} params.id - The id of the agent profile to delete.
107
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
108
+ * @throws {Error} Throws an error if the id parameter is missing.
109
+ * @returns {Promise<Object>} - The inactivated agent profile returned from the server.
110
+ */
111
+ async deleteAgentProfile({ id, options = {} }) {
112
+ this.client._require({ id });
113
+ const safeId = encodeURIComponent(id);
114
+ return this.client(`/agent/profiles/${safeId}`, { method: "DELETE", ...options });
115
+ }
116
+
117
+ /**
118
+ * Send a message to an agent and get its reply — the app-native conversation
119
+ * endpoint (webchat / SMS). Omit conversationId to start a new conversation, or
120
+ * pass one to continue an existing one. Runs the agent's LLM tool loop server-side
121
+ * and returns the assistant's reply along with any tools it invoked.
122
+ * @async
123
+ * @roles api, admin, developer, billing, user
124
+ * @param {Object} params - The parameters for sending a message.
125
+ * @param {string} params.agentProfileId - The agent to talk to (required).
126
+ * @param {string} params.channel - The channel: "webchat", "sms", or "voice" (required).
127
+ * @param {string} params.message - The user's message (required).
128
+ * @param {string} [params.conversationId] - Continue this conversation; omit to start a new one.
129
+ * @param {string} [params.contactIdentifier] - The far-end identifier (webchat visitor id, sender number).
130
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
131
+ * @throws {Error} Throws an error if agentProfileId, channel, or message is missing.
132
+ * @returns {Promise<Object>} - `{ conversationId, conversationSessionId, reply, toolInvocations, ok }` from the server.
133
+ */
134
+ async sendAgentMessage({ agentProfileId, channel, message, conversationId, contactIdentifier, options = {} }) {
135
+ this.client._require({ agentProfileId, channel, message });
136
+ const body = { agentProfileId, channel, message };
137
+ if (conversationId !== undefined && conversationId !== null) body.conversationId = conversationId;
138
+ if (contactIdentifier !== undefined && contactIdentifier !== null) body.contactIdentifier = contactIdentifier;
139
+ return this.client(`/agent/messages`, { method: "POST", body, ...options });
140
+ }
141
+
142
+ /**
143
+ * List an agent's per-channel settings (the tools enabled per channel, whether the
144
+ * channel is on, and any channel-specific prompt/greeting).
145
+ * @async
146
+ * @roles api, admin, developer, billing, user
147
+ * @param {Object} params - The parameters for listing channel settings.
148
+ * @param {string} params.agentProfileId - The agent whose channel settings to list.
149
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
150
+ * @throws {Error} Throws an error if the agentProfileId parameter is missing.
151
+ * @returns {Promise<Object>} - The agent's channel settings returned from the server.
152
+ */
153
+ async getAgentChannelSettings({ agentProfileId, options = {} }) {
154
+ this.client._require({ agentProfileId });
155
+ const safeId = encodeURIComponent(agentProfileId);
156
+ return this.client(`/agent/profiles/${safeId}/channels`, { method: "GET", ...options });
157
+ }
158
+
159
+ /**
160
+ * Get a single per-channel setting for an agent.
161
+ * @async
162
+ * @roles api, admin, developer, billing, user
163
+ * @param {Object} params - The parameters for getting a channel setting.
164
+ * @param {string} params.agentProfileId - The agent the setting belongs to.
165
+ * @param {string} params.channel - The channel: "webchat", "sms", or "voice".
166
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
167
+ * @throws {Error} Throws an error if agentProfileId or channel is missing.
168
+ * @returns {Promise<Object>} - The channel setting returned from the server.
169
+ */
170
+ async getAgentChannelSetting({ agentProfileId, channel, options = {} }) {
171
+ this.client._require({ agentProfileId, channel });
172
+ const safeId = encodeURIComponent(agentProfileId);
173
+ const safeChannel = encodeURIComponent(channel);
174
+ return this.client(`/agent/profiles/${safeId}/channels/${safeChannel}`, { method: "GET", ...options });
175
+ }
176
+
177
+ /**
178
+ * Create or update (upsert) an agent's per-channel setting. One row per (agent, channel);
179
+ * the channel is taken from the path, the fields from settingData.
180
+ * @async
181
+ * @roles api, admin, developer
182
+ * @param {Object} params - The parameters for the upsert.
183
+ * @param {string} params.agentProfileId - The agent the setting belongs to.
184
+ * @param {string} params.channel - The channel: "webchat", "sms", or "voice".
185
+ * @param {Object} [params.settingData] - The fields to set: allowedTools (string[]), enabled (boolean), channelPrompt (string), greeting (string|null).
186
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
187
+ * @throws {Error} Throws an error if agentProfileId or channel is missing.
188
+ * @returns {Promise<Object>} - The created or updated channel setting returned from the server.
189
+ */
190
+ async upsertAgentChannelSetting({ agentProfileId, channel, settingData = {}, options = {} }) {
191
+ this.client._require({ agentProfileId, channel });
192
+ const safeId = encodeURIComponent(agentProfileId);
193
+ const safeChannel = encodeURIComponent(channel);
194
+ return this.client(`/agent/profiles/${safeId}/channels/${safeChannel}`, { method: "PUT", body: settingData, ...options });
195
+ }
196
+
197
+ /**
198
+ * Delete an agent's per-channel setting.
199
+ * @async
200
+ * @roles api, admin, developer
201
+ * @param {Object} params - The parameters for the delete.
202
+ * @param {string} params.agentProfileId - The agent the setting belongs to.
203
+ * @param {string} params.channel - The channel: "webchat", "sms", or "voice".
204
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
205
+ * @throws {Error} Throws an error if agentProfileId or channel is missing.
206
+ * @returns {Promise<Object>} - The delete confirmation returned from the server.
207
+ */
208
+ async deleteAgentChannelSetting({ agentProfileId, channel, options = {} }) {
209
+ this.client._require({ agentProfileId, channel });
210
+ const safeId = encodeURIComponent(agentProfileId);
211
+ const safeChannel = encodeURIComponent(channel);
212
+ return this.client(`/agent/profiles/${safeId}/channels/${safeChannel}`, { method: "DELETE", ...options });
213
+ }
214
+
215
+ /**
216
+ * Read the tenant AI settings for a scope (group, or a subgroup within it) — brand, tone,
217
+ * timezone, business hours, and after-hours message. Returns the scope's own row only (no
218
+ * group-level fallback).
219
+ * @async
220
+ * @roles api, admin, developer, billing, user
221
+ * @param {Object} params - The parameters for reading tenant settings.
222
+ * @param {string} params.groupId - The group (required).
223
+ * @param {string} [params.subgroupId] - The subgroup; omit for the group-level settings.
224
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
225
+ * @throws {Error} Throws an error if the groupId parameter is missing.
226
+ * @returns {Promise<Object>} - The tenant settings returned from the server.
227
+ */
228
+ async getTenantAiSettings({ groupId, subgroupId, options = {} }) {
229
+ this.client._require({ groupId });
230
+ const queryString = this.client._getQueryString({ groupId, subgroupId });
231
+ return this.client(`/agent/tenant-settings${queryString}`, { method: "GET", ...options });
232
+ }
233
+
234
+ /**
235
+ * Create or update (upsert) the tenant AI settings for a scope. The scope is identified by
236
+ * the query params; the body carries the settings fields.
237
+ * @async
238
+ * @roles api, admin, developer
239
+ * @param {Object} params - The parameters for the upsert.
240
+ * @param {string} params.groupId - The group (required).
241
+ * @param {string} [params.subgroupId] - The subgroup; omit for the group-level settings.
242
+ * @param {Object} [params.settingsData] - Fields to set: brandName (string), tone (string), timezone (IANA string), businessHours (array of {day, closed, open, close}), afterHoursMessage (string).
243
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
244
+ * @throws {Error} Throws an error if the groupId parameter is missing.
245
+ * @returns {Promise<Object>} - The created or updated tenant settings returned from the server.
246
+ */
247
+ async upsertTenantAiSettings({ groupId, subgroupId, settingsData = {}, options = {} }) {
248
+ this.client._require({ groupId });
249
+ const queryString = this.client._getQueryString({ groupId, subgroupId });
250
+ return this.client(`/agent/tenant-settings${queryString}`, { method: "PUT", body: settingsData, ...options });
251
+ }
252
+
253
+ /**
254
+ * Delete the tenant AI settings for a scope.
255
+ * @async
256
+ * @roles api, admin, developer
257
+ * @param {Object} params - The parameters for the delete.
258
+ * @param {string} params.groupId - The group (required).
259
+ * @param {string} [params.subgroupId] - The subgroup; omit for the group-level settings.
260
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
261
+ * @throws {Error} Throws an error if the groupId parameter is missing.
262
+ * @returns {Promise<Object>} - The delete confirmation returned from the server.
263
+ */
264
+ async deleteTenantAiSettings({ groupId, subgroupId, options = {} }) {
265
+ this.client._require({ groupId });
266
+ const queryString = this.client._getQueryString({ groupId, subgroupId });
267
+ return this.client(`/agent/tenant-settings${queryString}`, { method: "DELETE", ...options });
268
+ }
269
+
270
+ /**
271
+ * List the knowledge-base items an agent can answer from (RAG), scoped to a group and
272
+ * optionally narrowed to a subgroup and/or a single agent.
273
+ * @async
274
+ * @roles api, admin, developer, billing, user
275
+ * @param {Object} params - The parameters for listing knowledge items.
276
+ * @param {string} params.groupId - The group whose knowledge to list (required).
277
+ * @param {string} [params.subgroupId] - Narrow to a subgroup.
278
+ * @param {string} [params.agentProfileId] - Narrow to one agent.
279
+ * @param {number} [params.page] - Page number (1-based) for pagination.
280
+ * @param {number} [params.limit] - Items per page (max 100; server default 25).
281
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
282
+ * @throws {Error} Throws an error if the groupId parameter is missing.
283
+ * @returns {Promise<Object>} - The knowledge items returned from the server.
284
+ */
285
+ async getKnowledgeItems({ groupId, subgroupId, agentProfileId, page, limit, options = {} }) {
286
+ this.client._require({ groupId });
287
+ const queryString = this.client._getQueryString({ groupId, subgroupId, agentProfileId, page, limit });
288
+ return this.client(`/agent/knowledge${queryString}`, { method: "GET", ...options });
289
+ }
290
+
291
+ /**
292
+ * Get a single knowledge item by id.
293
+ * @async
294
+ * @roles api, admin, developer, billing, user
295
+ * @param {Object} params - The parameters for getting a knowledge item.
296
+ * @param {string} params.knowledgeItemId - The id of the knowledge item to fetch.
297
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
298
+ * @throws {Error} Throws an error if the knowledgeItemId parameter is missing.
299
+ * @returns {Promise<Object>} - The knowledge item returned from the server.
300
+ */
301
+ async getKnowledgeItem({ knowledgeItemId, options = {} }) {
302
+ this.client._require({ knowledgeItemId });
303
+ const safeId = encodeURIComponent(knowledgeItemId);
304
+ return this.client(`/agent/knowledge/${safeId}`, { method: "GET", ...options });
305
+ }
306
+
307
+ /**
308
+ * Create a knowledge item. The raw `text` is stored and Atlas Vector Search owns the
309
+ * embedding — there is no embedding to supply.
310
+ * @async
311
+ * @roles api, admin, developer
312
+ * @param {Object} params - The parameters for creating a knowledge item.
313
+ * @param {Object} params.itemData - The knowledge fields. Required: groupId (starts with 'G'), text.
314
+ * Optional: subgroupId (starts with 'S', nullable), agentProfileId
315
+ * (nullable = shared across the tenant's agents), title, source
316
+ * ("manual" | "url" | "document" | "import"), enabled (boolean), metadata (object|null).
317
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
318
+ * @throws {Error} Throws an error if the itemData parameter is missing.
319
+ * @returns {Promise<Object>} - The created knowledge item returned from the server.
320
+ */
321
+ async createKnowledgeItem({ itemData, options = {} }) {
322
+ this.client._require({ itemData });
323
+ return this.client(`/agent/knowledge`, { method: "POST", body: itemData, ...options });
324
+ }
325
+
326
+ /**
327
+ * Update a knowledge item. The item's scope (group/subgroup/agent) is immutable and
328
+ * cannot be changed.
329
+ * @async
330
+ * @roles api, admin, developer
331
+ * @param {Object} params - The parameters for updating a knowledge item.
332
+ * @param {string} params.id - The id of the knowledge item to update.
333
+ * @param {Object} params.updateData - The fields to update: title, text, source, enabled, metadata.
334
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
335
+ * @throws {Error} Throws an error if the id or updateData parameter is missing.
336
+ * @returns {Promise<Object>} - The updated knowledge item returned from the server.
337
+ */
338
+ async updateKnowledgeItem({ id, updateData, options = {} }) {
339
+ this.client._require({ id, updateData });
340
+ const safeId = encodeURIComponent(id);
341
+ return this.client(`/agent/knowledge/${safeId}`, { method: "PUT", body: updateData, ...options });
342
+ }
343
+
344
+ /**
345
+ * Delete a knowledge item by its id.
346
+ * @async
347
+ * @roles api, admin, developer
348
+ * @param {Object} params - The parameters for deleting a knowledge item.
349
+ * @param {string} params.id - The id of the knowledge item to delete.
350
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
351
+ * @throws {Error} Throws an error if the id parameter is missing.
352
+ * @returns {Promise<Object>} - The delete confirmation returned from the server.
353
+ */
354
+ async deleteKnowledgeItem({ id, options = {} }) {
355
+ this.client._require({ id });
356
+ const safeId = encodeURIComponent(id);
357
+ return this.client(`/agent/knowledge/${safeId}`, { method: "DELETE", ...options });
358
+ }
359
+
360
+ /**
361
+ * List the tools defined under a group — custom webhook tools, configured built-ins, and
362
+ * (future) MCP. `webhookAuth` secrets are redacted in the response.
363
+ * @async
364
+ * @roles api, admin, developer, billing, user
365
+ * @param {Object} params - The parameters for listing tools.
366
+ * @param {string} params.groupId - The group whose tools to list (required).
367
+ * @param {string} [params.subgroupId] - Narrow to a subgroup.
368
+ * @param {string} [params.agentProfileId] - Narrow to one agent.
369
+ * @param {string} [params.type] - Narrow to a tool type: "builtin", "webhook", or "mcp".
370
+ * @param {number} [params.page] - Page number (1-based) for pagination.
371
+ * @param {number} [params.limit] - Items per page (max 100; server default 25).
372
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
373
+ * @throws {Error} Throws an error if the groupId parameter is missing.
374
+ * @returns {Promise<Object>} - The tools returned from the server (secrets redacted).
375
+ */
376
+ async getAgentTools({ groupId, subgroupId, agentProfileId, type, page, limit, options = {} }) {
377
+ this.client._require({ groupId });
378
+ const queryString = this.client._getQueryString({ groupId, subgroupId, agentProfileId, type, page, limit });
379
+ return this.client(`/agent/tools${queryString}`, { method: "GET", ...options });
380
+ }
381
+
382
+ /**
383
+ * Get a single agent tool by id. `webhookAuth` secrets are redacted in the response.
384
+ * @async
385
+ * @roles api, admin, developer, billing, user
386
+ * @param {Object} params - The parameters for getting a tool.
387
+ * @param {string} params.agentToolId - The id of the tool to fetch.
388
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
389
+ * @throws {Error} Throws an error if the agentToolId parameter is missing.
390
+ * @returns {Promise<Object>} - The tool returned from the server (secrets redacted).
391
+ */
392
+ async getAgentTool({ agentToolId, options = {} }) {
393
+ this.client._require({ agentToolId });
394
+ const safeId = encodeURIComponent(agentToolId);
395
+ return this.client(`/agent/tools/${safeId}`, { method: "GET", ...options });
396
+ }
397
+
398
+ /**
399
+ * Create an agent tool. For a webhook tool, `webhookUrl` must be an https URL that does not
400
+ * target a private/internal address (rejected otherwise). `webhookAuth` is stored and never
401
+ * echoed back.
402
+ * @async
403
+ * @roles api, admin, developer
404
+ * @param {Object} params - The parameters for creating a tool.
405
+ * @param {Object} params.toolData - The tool fields. Required: groupId (starts with 'G'), name, description.
406
+ * Type-specific: type ("builtin" | "webhook" | "mcp"); webhook → webhookUrl, builtin →
407
+ * builtinKey, mcp → mcpServerUrl. Optional: subgroupId, agentProfileId (nullable = shared),
408
+ * parametersSchema, config, channels (string[]), enabled (boolean), and webhookAuth —
409
+ * which MUST be `{ headers?: { [name]: value }, signingSecret?: string }` (any other shape,
410
+ * e.g. `{ header, value }`, is rejected with a 400). `headers` are sent verbatim on every
411
+ * call (reserved/framing and `x-signalhouse-*` names are rejected); `signingSecret` makes us
412
+ * send `X-SignalHouse-Signature: sha256=HMAC-SHA256(`${X-SignalHouse-Timestamp}.${rawBody}`)`
413
+ * so you can verify the call and reject replays. Stored, never returned.
414
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
415
+ * @throws {Error} Throws an error if the toolData parameter is missing.
416
+ * @returns {Promise<Object>} - The created tool returned from the server (secrets redacted).
417
+ */
418
+ async createAgentTool({ toolData, options = {} }) {
419
+ this.client._require({ toolData });
420
+ return this.client(`/agent/tools`, { method: "POST", body: toolData, ...options });
421
+ }
422
+
423
+ /**
424
+ * Update an agent tool. The tool's scope (group/subgroup/agent) is immutable. A supplied
425
+ * `webhookUrl` is SSRF-checked.
426
+ * @async
427
+ * @roles api, admin, developer
428
+ * @param {Object} params - The parameters for updating a tool.
429
+ * @param {string} params.id - The id of the tool to update.
430
+ * @param {Object} params.updateData - The fields to update: name, description, type, builtinKey, parametersSchema, config, webhookUrl, webhookAuth, mcpServerUrl, channels, enabled.
431
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
432
+ * @throws {Error} Throws an error if the id or updateData parameter is missing.
433
+ * @returns {Promise<Object>} - The updated tool returned from the server (secrets redacted).
434
+ */
435
+ async updateAgentTool({ id, updateData, options = {} }) {
436
+ this.client._require({ id, updateData });
437
+ const safeId = encodeURIComponent(id);
438
+ return this.client(`/agent/tools/${safeId}`, { method: "PUT", body: updateData, ...options });
439
+ }
440
+
441
+ /**
442
+ * Delete an agent tool by its id.
443
+ * @async
444
+ * @roles api, admin, developer
445
+ * @param {Object} params - The parameters for deleting a tool.
446
+ * @param {string} params.id - The id of the tool to delete.
447
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
448
+ * @throws {Error} Throws an error if the id parameter is missing.
449
+ * @returns {Promise<Object>} - The delete confirmation returned from the server.
450
+ */
451
+ async deleteAgentTool({ id, options = {} }) {
452
+ this.client._require({ id });
453
+ const safeId = encodeURIComponent(id);
454
+ return this.client(`/agent/tools/${safeId}`, { method: "DELETE", ...options });
455
+ }
456
+ }