@chanl-ai/sdk 2.0.1
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/adapters/openai.d.ts +106 -0
- package/dist/adapters/openai.d.ts.map +1 -0
- package/dist/adapters/openai.js +185 -0
- package/dist/adapters/openai.js.map +1 -0
- package/dist/client.d.ts +74 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +293 -0
- package/dist/client.js.map +1 -0
- package/dist/errors/index.d.ts +179 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +319 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/live/index.d.ts +9 -0
- package/dist/live/index.d.ts.map +1 -0
- package/dist/live/index.js +16 -0
- package/dist/live/index.js.map +1 -0
- package/dist/live/live-call.d.ts +48 -0
- package/dist/live/live-call.d.ts.map +1 -0
- package/dist/live/live-call.js +148 -0
- package/dist/live/live-call.js.map +1 -0
- package/dist/live/live-chat.d.ts +71 -0
- package/dist/live/live-chat.d.ts.map +1 -0
- package/dist/live/live-chat.js +95 -0
- package/dist/live/live-chat.js.map +1 -0
- package/dist/live/live-execution.d.ts +55 -0
- package/dist/live/live-execution.d.ts.map +1 -0
- package/dist/live/live-execution.js +170 -0
- package/dist/live/live-execution.js.map +1 -0
- package/dist/live/typed-emitter.d.ts +15 -0
- package/dist/live/typed-emitter.d.ts.map +1 -0
- package/dist/live/typed-emitter.js +40 -0
- package/dist/live/typed-emitter.js.map +1 -0
- package/dist/live/types.d.ts +24 -0
- package/dist/live/types.d.ts.map +1 -0
- package/dist/live/types.js +6 -0
- package/dist/live/types.js.map +1 -0
- package/dist/modules/agents.d.ts +378 -0
- package/dist/modules/agents.d.ts.map +1 -0
- package/dist/modules/agents.js +259 -0
- package/dist/modules/agents.js.map +1 -0
- package/dist/modules/alerts.d.ts +43 -0
- package/dist/modules/alerts.d.ts.map +1 -0
- package/dist/modules/alerts.js +56 -0
- package/dist/modules/alerts.js.map +1 -0
- package/dist/modules/audio.d.ts +47 -0
- package/dist/modules/audio.d.ts.map +1 -0
- package/dist/modules/audio.js +75 -0
- package/dist/modules/audio.js.map +1 -0
- package/dist/modules/auth.d.ts +76 -0
- package/dist/modules/auth.d.ts.map +1 -0
- package/dist/modules/auth.js +59 -0
- package/dist/modules/auth.js.map +1 -0
- package/dist/modules/calls.d.ts +825 -0
- package/dist/modules/calls.d.ts.map +1 -0
- package/dist/modules/calls.js +398 -0
- package/dist/modules/calls.js.map +1 -0
- package/dist/modules/chat.d.ts +165 -0
- package/dist/modules/chat.d.ts.map +1 -0
- package/dist/modules/chat.js +169 -0
- package/dist/modules/chat.js.map +1 -0
- package/dist/modules/health.d.ts +45 -0
- package/dist/modules/health.d.ts.map +1 -0
- package/dist/modules/health.js +22 -0
- package/dist/modules/health.js.map +1 -0
- package/dist/modules/knowledge.d.ts +202 -0
- package/dist/modules/knowledge.d.ts.map +1 -0
- package/dist/modules/knowledge.js +147 -0
- package/dist/modules/knowledge.js.map +1 -0
- package/dist/modules/mcp.d.ts +140 -0
- package/dist/modules/mcp.d.ts.map +1 -0
- package/dist/modules/mcp.js +110 -0
- package/dist/modules/mcp.js.map +1 -0
- package/dist/modules/memory.d.ts +163 -0
- package/dist/modules/memory.d.ts.map +1 -0
- package/dist/modules/memory.js +208 -0
- package/dist/modules/memory.js.map +1 -0
- package/dist/modules/personas.d.ts +168 -0
- package/dist/modules/personas.d.ts.map +1 -0
- package/dist/modules/personas.js +106 -0
- package/dist/modules/personas.js.map +1 -0
- package/dist/modules/prompts.d.ts +128 -0
- package/dist/modules/prompts.d.ts.map +1 -0
- package/dist/modules/prompts.js +93 -0
- package/dist/modules/prompts.js.map +1 -0
- package/dist/modules/scenarios.d.ts +294 -0
- package/dist/modules/scenarios.d.ts.map +1 -0
- package/dist/modules/scenarios.js +349 -0
- package/dist/modules/scenarios.js.map +1 -0
- package/dist/modules/scorecard.d.ts +642 -0
- package/dist/modules/scorecard.d.ts.map +1 -0
- package/dist/modules/scorecard.js +327 -0
- package/dist/modules/scorecard.js.map +1 -0
- package/dist/modules/tools.d.ts +222 -0
- package/dist/modules/tools.d.ts.map +1 -0
- package/dist/modules/tools.js +302 -0
- package/dist/modules/tools.js.map +1 -0
- package/dist/modules/toolsets.d.ts +173 -0
- package/dist/modules/toolsets.d.ts.map +1 -0
- package/dist/modules/toolsets.js +216 -0
- package/dist/modules/toolsets.js.map +1 -0
- package/dist/modules/transcript.d.ts +60 -0
- package/dist/modules/transcript.d.ts.map +1 -0
- package/dist/modules/transcript.js +69 -0
- package/dist/modules/transcript.js.map +1 -0
- package/dist/modules/workspace.d.ts +48 -0
- package/dist/modules/workspace.d.ts.map +1 -0
- package/dist/modules/workspace.js +49 -0
- package/dist/modules/workspace.js.map +1 -0
- package/dist/types/api.d.ts +8 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +25 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/config.d.ts +70 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/memory.d.ts +243 -0
- package/dist/types/memory.d.ts.map +1 -0
- package/dist/types/memory.js +9 -0
- package/dist/types/memory.js.map +1 -0
- package/dist/types/tool-calls.d.ts +61 -0
- package/dist/types/tool-calls.d.ts.map +1 -0
- package/dist/types/tool-calls.js +9 -0
- package/dist/types/tool-calls.js.map +1 -0
- package/dist/types/tools.d.ts +321 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +9 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types/toolsets.d.ts +149 -0
- package/dist/types/toolsets.d.ts.map +1 -0
- package/dist/types/toolsets.js +8 -0
- package/dist/types/toolsets.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ToolsModule - SDK module for MCP tool management and execution
|
|
4
|
+
*
|
|
5
|
+
* TDD Phase: GREEN - Implementation to make tests pass
|
|
6
|
+
*
|
|
7
|
+
* Provides CRUD operations for tools and execution capabilities.
|
|
8
|
+
* Supports both JWT auth (admin UI) and MCP API key auth.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.ToolsModule = void 0;
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// TOOLS MODULE
|
|
14
|
+
// ============================================================================
|
|
15
|
+
class ToolsModule {
|
|
16
|
+
constructor(sdk) {
|
|
17
|
+
this.sdk = sdk;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* List all tools with optional filters
|
|
21
|
+
*
|
|
22
|
+
* @param filters - Optional filters for the query
|
|
23
|
+
* @returns Paginated list of tools
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* // List all tools
|
|
28
|
+
* const { data } = await sdk.tools.list();
|
|
29
|
+
*
|
|
30
|
+
* // Filter by type and status
|
|
31
|
+
* const { data } = await sdk.tools.list({
|
|
32
|
+
* type: 'http',
|
|
33
|
+
* isEnabled: true,
|
|
34
|
+
* page: 1,
|
|
35
|
+
* limit: 10
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* // Exclude system tools (kb_search, chanl_reason, etc.)
|
|
39
|
+
* const { data } = await sdk.tools.list({
|
|
40
|
+
* includeSystem: false
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
async list(filters) {
|
|
45
|
+
const queryParams = new URLSearchParams();
|
|
46
|
+
if (filters?.type) {
|
|
47
|
+
queryParams.append('type', filters.type);
|
|
48
|
+
}
|
|
49
|
+
if (filters?.isEnabled !== undefined) {
|
|
50
|
+
queryParams.append('isEnabled', String(filters.isEnabled));
|
|
51
|
+
}
|
|
52
|
+
if (filters?.search) {
|
|
53
|
+
queryParams.append('search', filters.search);
|
|
54
|
+
}
|
|
55
|
+
if (filters?.tag) {
|
|
56
|
+
queryParams.append('tag', filters.tag);
|
|
57
|
+
}
|
|
58
|
+
if (filters?.includeSystem !== undefined) {
|
|
59
|
+
queryParams.append('includeSystem', String(filters.includeSystem));
|
|
60
|
+
}
|
|
61
|
+
if (filters?.page) {
|
|
62
|
+
queryParams.append('page', filters.page.toString());
|
|
63
|
+
}
|
|
64
|
+
if (filters?.limit) {
|
|
65
|
+
queryParams.append('limit', filters.limit.toString());
|
|
66
|
+
}
|
|
67
|
+
if (filters?.sortBy) {
|
|
68
|
+
queryParams.append('sortBy', filters.sortBy);
|
|
69
|
+
}
|
|
70
|
+
if (filters?.sortOrder) {
|
|
71
|
+
queryParams.append('sortOrder', filters.sortOrder);
|
|
72
|
+
}
|
|
73
|
+
const url = `/api/v1/tools${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
74
|
+
return this.sdk.request('GET', url);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get a single tool by ID
|
|
78
|
+
*
|
|
79
|
+
* @param id - Tool ID
|
|
80
|
+
* @returns Tool details
|
|
81
|
+
* @throws NotFoundError if tool doesn't exist
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const { data } = await sdk.tools.get('tool_abc123');
|
|
86
|
+
* console.log(data.tool.name);
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
async get(id) {
|
|
90
|
+
return this.sdk.request('GET', `/api/v1/tools/${id}`);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Create a new tool
|
|
94
|
+
*
|
|
95
|
+
* @param workspaceId - Workspace ID
|
|
96
|
+
* @param input - Tool creation data
|
|
97
|
+
* @returns Created tool
|
|
98
|
+
* @throws ValidationError if input is invalid
|
|
99
|
+
* @throws ConflictError if tool name already exists
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const { data } = await sdk.tools.create({
|
|
104
|
+
* name: 'get_weather',
|
|
105
|
+
* description: 'Get weather for a city',
|
|
106
|
+
* type: 'http',
|
|
107
|
+
* inputSchema: {
|
|
108
|
+
* type: 'object',
|
|
109
|
+
* properties: { city: { type: 'string' } },
|
|
110
|
+
* required: ['city']
|
|
111
|
+
* },
|
|
112
|
+
* configuration: {
|
|
113
|
+
* http: { method: 'GET', url: 'https://wttr.in/{{city}}' }
|
|
114
|
+
* }
|
|
115
|
+
* });
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
async create(input) {
|
|
119
|
+
return this.sdk.request('POST', `/api/v1/tools`, input);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Update an existing tool
|
|
123
|
+
*
|
|
124
|
+
* @param workspaceId - Workspace ID
|
|
125
|
+
* @param id - Tool ID
|
|
126
|
+
* @param input - Update data
|
|
127
|
+
* @returns Updated tool
|
|
128
|
+
* @throws NotFoundError if tool doesn't exist
|
|
129
|
+
* @throws ValidationError if input is invalid
|
|
130
|
+
* @throws ConflictError if new name already exists
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* const { data } = await sdk.tools.update('tool_abc123', {
|
|
135
|
+
* description: 'Updated description',
|
|
136
|
+
* isEnabled: false
|
|
137
|
+
* });
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
async update(id, input) {
|
|
141
|
+
return this.sdk.request('PATCH', `/api/v1/tools/${id}`, input);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Delete a tool
|
|
145
|
+
*
|
|
146
|
+
* @param workspaceId - Workspace ID
|
|
147
|
+
* @param id - Tool ID
|
|
148
|
+
* @returns Deletion confirmation
|
|
149
|
+
* @throws NotFoundError if tool doesn't exist
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* const { data } = await sdk.tools.delete('tool_abc123');
|
|
154
|
+
* console.log(data.deleted); // true
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
async delete(id) {
|
|
158
|
+
return this.sdk.request('DELETE', `/api/v1/tools/${id}`);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Execute a tool with given arguments
|
|
162
|
+
*
|
|
163
|
+
* @param workspaceId - Workspace ID
|
|
164
|
+
* @param id - Tool ID
|
|
165
|
+
* @param args - Arguments to pass to the tool
|
|
166
|
+
* @returns Execution result
|
|
167
|
+
* @throws NotFoundError if tool doesn't exist
|
|
168
|
+
* @throws ValidationError if args don't match input schema
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* const { data } = await sdk.tools.execute('tool_abc123', {
|
|
173
|
+
* city: 'London',
|
|
174
|
+
* units: 'celsius'
|
|
175
|
+
* });
|
|
176
|
+
* console.log(data.output); // { temperature: 12, ... }
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
async execute(id, args) {
|
|
180
|
+
return this.sdk.request('POST', `/api/v1/tools/${id}/execute`, {
|
|
181
|
+
arguments: args,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Test a tool execution (same as execute but for testing in admin UI)
|
|
186
|
+
*
|
|
187
|
+
* @param workspaceId - Workspace ID
|
|
188
|
+
* @param id - Tool ID
|
|
189
|
+
* @param args - Arguments to pass to the tool
|
|
190
|
+
* @returns Execution result
|
|
191
|
+
* @throws NotFoundError if tool doesn't exist
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```typescript
|
|
195
|
+
* const { data } = await sdk.tools.test('tool_abc123', {
|
|
196
|
+
* city: 'London'
|
|
197
|
+
* });
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
async test(id, args) {
|
|
201
|
+
return this.sdk.request('POST', `/api/v1/tools/${id}/test`, {
|
|
202
|
+
arguments: args,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Get execution history for a tool
|
|
207
|
+
*
|
|
208
|
+
* @param workspaceId - Workspace ID
|
|
209
|
+
* @param id - Tool ID
|
|
210
|
+
* @param filters - Optional filters for the query
|
|
211
|
+
* @returns Paginated list of executions
|
|
212
|
+
* @throws NotFoundError if tool doesn't exist
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```typescript
|
|
216
|
+
* // Get all executions
|
|
217
|
+
* const { data } = await sdk.tools.getExecutions('ws_123', 'tool_abc123');
|
|
218
|
+
*
|
|
219
|
+
* // Filter by status and date range
|
|
220
|
+
* const { data } = await sdk.tools.getExecutions('ws_123', 'tool_abc123', {
|
|
221
|
+
* status: 'completed',
|
|
222
|
+
* fromDate: '2025-01-01',
|
|
223
|
+
* toDate: '2025-01-31'
|
|
224
|
+
* });
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
async getExecutions(id, filters) {
|
|
228
|
+
const queryParams = new URLSearchParams();
|
|
229
|
+
if (filters?.status) {
|
|
230
|
+
queryParams.append('status', filters.status);
|
|
231
|
+
}
|
|
232
|
+
if (filters?.source) {
|
|
233
|
+
queryParams.append('source', filters.source);
|
|
234
|
+
}
|
|
235
|
+
if (filters?.fromDate) {
|
|
236
|
+
queryParams.append('fromDate', filters.fromDate);
|
|
237
|
+
}
|
|
238
|
+
if (filters?.toDate) {
|
|
239
|
+
queryParams.append('toDate', filters.toDate);
|
|
240
|
+
}
|
|
241
|
+
if (filters?.page) {
|
|
242
|
+
queryParams.append('page', filters.page.toString());
|
|
243
|
+
}
|
|
244
|
+
if (filters?.limit) {
|
|
245
|
+
queryParams.append('limit', filters.limit.toString());
|
|
246
|
+
}
|
|
247
|
+
const url = `/api/v1/tools/${id}/executions${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
248
|
+
return this.sdk.request('GET', url);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Enable a tool (shortcut for setting isEnabled=true)
|
|
252
|
+
*
|
|
253
|
+
* @param workspaceId - Workspace ID
|
|
254
|
+
* @param id - Tool ID
|
|
255
|
+
* @returns Updated tool
|
|
256
|
+
* @throws NotFoundError if tool doesn't exist
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```typescript
|
|
260
|
+
* const { data } = await sdk.tools.enable('tool_abc123');
|
|
261
|
+
* console.log(data.tool.isEnabled); // true
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
async enable(id) {
|
|
265
|
+
return this.sdk.request('POST', `/api/v1/tools/${id}/enable`);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Disable a tool (shortcut for setting isEnabled=false)
|
|
269
|
+
*
|
|
270
|
+
* @param workspaceId - Workspace ID
|
|
271
|
+
* @param id - Tool ID
|
|
272
|
+
* @returns Updated tool
|
|
273
|
+
* @throws NotFoundError if tool doesn't exist
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```typescript
|
|
277
|
+
* const { data } = await sdk.tools.disable('tool_abc123');
|
|
278
|
+
* console.log(data.tool.isEnabled); // false
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
async disable(id) {
|
|
282
|
+
return this.sdk.request('POST', `/api/v1/tools/${id}/disable`);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get tool categories (aggregated tags with counts)
|
|
286
|
+
*
|
|
287
|
+
* @param workspaceId - Workspace ID
|
|
288
|
+
* @returns List of categories with counts
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```typescript
|
|
292
|
+
* const { data } = await sdk.tools.getCategories('ws_123');
|
|
293
|
+
* console.log(data.categories);
|
|
294
|
+
* // [{ name: 'weather', count: 5, enabledCount: 3 }, ...]
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
async getCategories() {
|
|
298
|
+
return this.sdk.request('GET', `/api/v1/tools/categories`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
exports.ToolsModule = ToolsModule;
|
|
302
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/modules/tools.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAiBH,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,MAAa,WAAW;IACtB,YAAoB,GAAa;QAAb,QAAG,GAAH,GAAG,CAAU;IAAG,CAAC;IAErC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,KAAK,CAAC,IAAI,CAAC,OAAqB;QAC9B,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAE1C,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;YAClB,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,OAAO,EAAE,SAAS,KAAK,SAAS,EAAE,CAAC;YACrC,WAAW,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;YACpB,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,OAAO,EAAE,GAAG,EAAE,CAAC;YACjB,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,OAAO,EAAE,aAAa,KAAK,SAAS,EAAE,CAAC;YACzC,WAAW,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;YAClB,WAAW,CAAC,MAAM,CAAC,MAA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AM,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;YAClB,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxD,CAAC;QAED,MAAM,GAAG,GAAG,iBAAiB,EAAE,cAAc,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC1G,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,OAAO,CAAC,EAAU;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,UAAU,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,0BAA0B,CAAC,CAAC;IAC7D,CAAC;CACF;AAtTD,kCAsTC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolsetsModule - SDK module for MCP toolset management
|
|
3
|
+
*
|
|
4
|
+
* Provides CRUD operations for toolsets (collections of tools).
|
|
5
|
+
* Supports both JWT auth (admin UI) and API key auth.
|
|
6
|
+
*/
|
|
7
|
+
import { ChanlSDK } from '../client';
|
|
8
|
+
import { ApiResponse } from '../types/config';
|
|
9
|
+
import type { CreateToolsetInput, UpdateToolsetInput, ToolsetFilters, ToolsetListResponse, ToolsetResponse, ToolsetDeleteResponse, ManageToolsInput, ToolOverride } from '../types/toolsets';
|
|
10
|
+
export declare class ToolsetsModule {
|
|
11
|
+
private sdk;
|
|
12
|
+
constructor(sdk: ChanlSDK);
|
|
13
|
+
/**
|
|
14
|
+
* List all toolsets with optional filters
|
|
15
|
+
*
|
|
16
|
+
* @param workspaceId - Workspace ID
|
|
17
|
+
* @param filters - Optional filters for the query
|
|
18
|
+
* @returns Paginated list of toolsets
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // List all toolsets
|
|
23
|
+
* const { data } = await sdk.toolsets.list();
|
|
24
|
+
*
|
|
25
|
+
* // Filter by enabled status
|
|
26
|
+
* const { data } = await sdk.toolsets.list({
|
|
27
|
+
* enabled: true,
|
|
28
|
+
* page: 1,
|
|
29
|
+
* limit: 10
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
list(filters?: ToolsetFilters): Promise<ApiResponse<ToolsetListResponse>>;
|
|
34
|
+
/**
|
|
35
|
+
* Get a single toolset by ID
|
|
36
|
+
*
|
|
37
|
+
* @param workspaceId - Workspace ID
|
|
38
|
+
* @param id - Toolset ID
|
|
39
|
+
* @returns Toolset details
|
|
40
|
+
* @throws NotFoundError if toolset doesn't exist
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const { data } = await sdk.toolsets.get('toolset_abc123');
|
|
45
|
+
* console.log(data.toolset.name);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
get(id: string): Promise<ApiResponse<ToolsetResponse>>;
|
|
49
|
+
/**
|
|
50
|
+
* Create a new toolset
|
|
51
|
+
*
|
|
52
|
+
* @param workspaceId - Workspace ID
|
|
53
|
+
* @param input - Toolset creation data
|
|
54
|
+
* @returns Created toolset
|
|
55
|
+
* @throws ValidationError if input is invalid
|
|
56
|
+
* @throws ConflictError if toolset name already exists
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const { data } = await sdk.toolsets.create({
|
|
61
|
+
* name: 'customer_support_tools',
|
|
62
|
+
* description: 'Tools for customer support agents',
|
|
63
|
+
* tools: ['tool_id_1', 'tool_id_2'],
|
|
64
|
+
* enabled: true,
|
|
65
|
+
* tags: ['support', 'customer-facing']
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
create(input: CreateToolsetInput): Promise<ApiResponse<ToolsetResponse>>;
|
|
70
|
+
/**
|
|
71
|
+
* Update an existing toolset
|
|
72
|
+
*
|
|
73
|
+
* @param workspaceId - Workspace ID
|
|
74
|
+
* @param id - Toolset ID
|
|
75
|
+
* @param input - Update data
|
|
76
|
+
* @returns Updated toolset
|
|
77
|
+
* @throws NotFoundError if toolset doesn't exist
|
|
78
|
+
* @throws ValidationError if input is invalid
|
|
79
|
+
* @throws ConflictError if new name already exists
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const { data } = await sdk.toolsets.update('toolset_abc123', {
|
|
84
|
+
* description: 'Updated description',
|
|
85
|
+
* enabled: false
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
update(id: string, input: UpdateToolsetInput): Promise<ApiResponse<ToolsetResponse>>;
|
|
90
|
+
/**
|
|
91
|
+
* Delete a toolset
|
|
92
|
+
*
|
|
93
|
+
* @param workspaceId - Workspace ID
|
|
94
|
+
* @param id - Toolset ID
|
|
95
|
+
* @returns Deletion confirmation
|
|
96
|
+
* @throws NotFoundError if toolset doesn't exist
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const { data } = await sdk.toolsets.delete('toolset_abc123');
|
|
101
|
+
* console.log(data.deleted); // true
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
delete(id: string): Promise<ApiResponse<ToolsetDeleteResponse>>;
|
|
105
|
+
/**
|
|
106
|
+
* Add or remove tools from a toolset
|
|
107
|
+
*
|
|
108
|
+
* @param workspaceId - Workspace ID
|
|
109
|
+
* @param id - Toolset ID
|
|
110
|
+
* @param input - Tools to add or remove
|
|
111
|
+
* @returns Updated toolset
|
|
112
|
+
* @throws NotFoundError if toolset doesn't exist
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* // Add tools
|
|
117
|
+
* const { data } = await sdk.toolsets.manageTools('ws_123', 'toolset_abc123', {
|
|
118
|
+
* add: ['tool_id_3', 'tool_id_4']
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* // Remove tools
|
|
122
|
+
* const { data } = await sdk.toolsets.manageTools('ws_123', 'toolset_abc123', {
|
|
123
|
+
* remove: ['tool_id_1']
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
manageTools(id: string, input: ManageToolsInput): Promise<ApiResponse<ToolsetResponse>>;
|
|
128
|
+
/**
|
|
129
|
+
* Set tool name/description overrides for a toolset
|
|
130
|
+
*
|
|
131
|
+
* @param workspaceId - Workspace ID
|
|
132
|
+
* @param id - Toolset ID
|
|
133
|
+
* @param overrides - Map of tool ID to override configuration
|
|
134
|
+
* @returns Updated toolset
|
|
135
|
+
* @throws NotFoundError if toolset doesn't exist
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const { data } = await sdk.toolsets.setOverrides('ws_123', 'toolset_abc123', {
|
|
140
|
+
* 'tool_id_1': { name: 'Custom Name', description: 'Custom description' }
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
setOverrides(id: string, overrides: Record<string, ToolOverride>): Promise<ApiResponse<ToolsetResponse>>;
|
|
145
|
+
/**
|
|
146
|
+
* Enable a toolset (shortcut for update with enabled: true)
|
|
147
|
+
*
|
|
148
|
+
* @param workspaceId - Workspace ID
|
|
149
|
+
* @param id - Toolset ID
|
|
150
|
+
* @returns Updated toolset
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* const { data } = await sdk.toolsets.enable('toolset_abc123');
|
|
155
|
+
* console.log(data.toolset.enabled); // true
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
enable(id: string): Promise<ApiResponse<ToolsetResponse>>;
|
|
159
|
+
/**
|
|
160
|
+
* Disable a toolset (shortcut for update with enabled: false)
|
|
161
|
+
*
|
|
162
|
+
* @param id - Toolset ID
|
|
163
|
+
* @returns Updated toolset
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* const { data } = await sdk.toolsets.disable('toolset_abc123');
|
|
168
|
+
* console.log(data.toolset.enabled); // false
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
disable(id: string): Promise<ApiResponse<ToolsetResponse>>;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=toolsets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/modules/toolsets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAM3B,qBAAa,cAAc;IACb,OAAO,CAAC,GAAG;gBAAH,GAA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|
3
|
+
* ToolsetsModule - SDK module for MCP toolset management
|
|
4
|
+
*
|
|
5
|
+
* Provides CRUD operations for toolsets (collections of tools).
|
|
6
|
+
* Supports both JWT auth (admin UI) and API key auth.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ToolsetsModule = void 0;
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// TOOLSETS MODULE
|
|
12
|
+
// ============================================================================
|
|
13
|
+
class ToolsetsModule {
|
|
14
|
+
constructor(sdk) {
|
|
15
|
+
this.sdk = sdk;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* List all toolsets with optional filters
|
|
19
|
+
*
|
|
20
|
+
* @param workspaceId - Workspace ID
|
|
21
|
+
* @param filters - Optional filters for the query
|
|
22
|
+
* @returns Paginated list of toolsets
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // List all toolsets
|
|
27
|
+
* const { data } = await sdk.toolsets.list();
|
|
28
|
+
*
|
|
29
|
+
* // Filter by enabled status
|
|
30
|
+
* const { data } = await sdk.toolsets.list({
|
|
31
|
+
* enabled: true,
|
|
32
|
+
* page: 1,
|
|
33
|
+
* limit: 10
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
async list(filters) {
|
|
38
|
+
const queryParams = new URLSearchParams();
|
|
39
|
+
if (filters?.search) {
|
|
40
|
+
queryParams.append('search', filters.search);
|
|
41
|
+
}
|
|
42
|
+
if (filters?.enabled !== undefined) {
|
|
43
|
+
queryParams.append('enabled', String(filters.enabled));
|
|
44
|
+
}
|
|
45
|
+
if (filters?.isPublic !== undefined) {
|
|
46
|
+
queryParams.append('isPublic', String(filters.isPublic));
|
|
47
|
+
}
|
|
48
|
+
if (filters?.tag) {
|
|
49
|
+
queryParams.append('tag', filters.tag);
|
|
50
|
+
}
|
|
51
|
+
if (filters?.page) {
|
|
52
|
+
queryParams.append('page', filters.page.toString());
|
|
53
|
+
}
|
|
54
|
+
if (filters?.limit) {
|
|
55
|
+
queryParams.append('limit', filters.limit.toString());
|
|
56
|
+
}
|
|
57
|
+
const url = `/api/v1/toolsets${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
58
|
+
return this.sdk.request('GET', url);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get a single toolset by ID
|
|
62
|
+
*
|
|
63
|
+
* @param workspaceId - Workspace ID
|
|
64
|
+
* @param id - Toolset ID
|
|
65
|
+
* @returns Toolset details
|
|
66
|
+
* @throws NotFoundError if toolset doesn't exist
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const { data } = await sdk.toolsets.get('toolset_abc123');
|
|
71
|
+
* console.log(data.toolset.name);
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
async get(id) {
|
|
75
|
+
return this.sdk.request('GET', `/api/v1/toolsets/${id}`);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create a new toolset
|
|
79
|
+
*
|
|
80
|
+
* @param workspaceId - Workspace ID
|
|
81
|
+
* @param input - Toolset creation data
|
|
82
|
+
* @returns Created toolset
|
|
83
|
+
* @throws ValidationError if input is invalid
|
|
84
|
+
* @throws ConflictError if toolset name already exists
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const { data } = await sdk.toolsets.create({
|
|
89
|
+
* name: 'customer_support_tools',
|
|
90
|
+
* description: 'Tools for customer support agents',
|
|
91
|
+
* tools: ['tool_id_1', 'tool_id_2'],
|
|
92
|
+
* enabled: true,
|
|
93
|
+
* tags: ['support', 'customer-facing']
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
async create(input) {
|
|
98
|
+
return this.sdk.request('POST', `/api/v1/toolsets`, input);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Update an existing toolset
|
|
102
|
+
*
|
|
103
|
+
* @param workspaceId - Workspace ID
|
|
104
|
+
* @param id - Toolset ID
|
|
105
|
+
* @param input - Update data
|
|
106
|
+
* @returns Updated toolset
|
|
107
|
+
* @throws NotFoundError if toolset doesn't exist
|
|
108
|
+
* @throws ValidationError if input is invalid
|
|
109
|
+
* @throws ConflictError if new name already exists
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* const { data } = await sdk.toolsets.update('toolset_abc123', {
|
|
114
|
+
* description: 'Updated description',
|
|
115
|
+
* enabled: false
|
|
116
|
+
* });
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
async update(id, input) {
|
|
120
|
+
return this.sdk.request('PATCH', `/api/v1/toolsets/${id}`, input);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Delete a toolset
|
|
124
|
+
*
|
|
125
|
+
* @param workspaceId - Workspace ID
|
|
126
|
+
* @param id - Toolset ID
|
|
127
|
+
* @returns Deletion confirmation
|
|
128
|
+
* @throws NotFoundError if toolset doesn't exist
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* const { data } = await sdk.toolsets.delete('toolset_abc123');
|
|
133
|
+
* console.log(data.deleted); // true
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
async delete(id) {
|
|
137
|
+
return this.sdk.request('DELETE', `/api/v1/toolsets/${id}`);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Add or remove tools from a toolset
|
|
141
|
+
*
|
|
142
|
+
* @param workspaceId - Workspace ID
|
|
143
|
+
* @param id - Toolset ID
|
|
144
|
+
* @param input - Tools to add or remove
|
|
145
|
+
* @returns Updated toolset
|
|
146
|
+
* @throws NotFoundError if toolset doesn't exist
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* // Add tools
|
|
151
|
+
* const { data } = await sdk.toolsets.manageTools('ws_123', 'toolset_abc123', {
|
|
152
|
+
* add: ['tool_id_3', 'tool_id_4']
|
|
153
|
+
* });
|
|
154
|
+
*
|
|
155
|
+
* // Remove tools
|
|
156
|
+
* const { data } = await sdk.toolsets.manageTools('ws_123', 'toolset_abc123', {
|
|
157
|
+
* remove: ['tool_id_1']
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
async manageTools(id, input) {
|
|
162
|
+
return this.sdk.request('PUT', `/api/v1/toolsets/${id}/tools`, input);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Set tool name/description overrides for a toolset
|
|
166
|
+
*
|
|
167
|
+
* @param workspaceId - Workspace ID
|
|
168
|
+
* @param id - Toolset ID
|
|
169
|
+
* @param overrides - Map of tool ID to override configuration
|
|
170
|
+
* @returns Updated toolset
|
|
171
|
+
* @throws NotFoundError if toolset doesn't exist
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* const { data } = await sdk.toolsets.setOverrides('ws_123', 'toolset_abc123', {
|
|
176
|
+
* 'tool_id_1': { name: 'Custom Name', description: 'Custom description' }
|
|
177
|
+
* });
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
async setOverrides(id, overrides) {
|
|
181
|
+
return this.sdk.request('PUT', `/api/v1/toolsets/${id}/overrides`, overrides);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Enable a toolset (shortcut for update with enabled: true)
|
|
185
|
+
*
|
|
186
|
+
* @param workspaceId - Workspace ID
|
|
187
|
+
* @param id - Toolset ID
|
|
188
|
+
* @returns Updated toolset
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const { data } = await sdk.toolsets.enable('toolset_abc123');
|
|
193
|
+
* console.log(data.toolset.enabled); // true
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
async enable(id) {
|
|
197
|
+
return this.update(id, { enabled: true });
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Disable a toolset (shortcut for update with enabled: false)
|
|
201
|
+
*
|
|
202
|
+
* @param id - Toolset ID
|
|
203
|
+
* @returns Updated toolset
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* const { data } = await sdk.toolsets.disable('toolset_abc123');
|
|
208
|
+
* console.log(data.toolset.enabled); // false
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
async disable(id) {
|
|
212
|
+
return this.update(id, { enabled: false });
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.ToolsetsModule = ToolsetsModule;
|
|
216
|
+
//# sourceMappingURL=toolsets.js.map
|