Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Update the comments/doc strings
haxzie committed
May 16, 2025 at 20:05 UTC
e49487a686c05fda4e81b62953967a4572ea0eba
1 file changed
+57
packages/core/src/models/Tools.ts
+57
@@ -259,6 +259,11 @@ export class Tools<
259
* Retrieves a tool by its Slug.
260
* @param slug The ID of the tool to be retrieved
261
* @returns {Promise<Tool>} The tool
262
+ *
263
+ * @example
264
+ * ```ts
265
+ * const tool = await composio.tools.getComposioToolBySlug('default', 'github');
266
+ * ```
267
*/
268
async getComposioToolBySlug(
269
userId: string,
@@ -288,16 +293,51 @@ export class Tools<
293
return modifiedToool;
294
}
295
296
+ /**
297
+ * Get a tool by its slug
298
+ * @param userId - The user id
299
+ * @param slug - The slug of the tool
300
+ * @param options - The options for the tool
301
+ * @returns The tool
302
+ *
303
+ * @example
304
+ * ```ts
305
+ * const tool = await composio.tools.get('default', 'github');
306
+ * ```
307
+ */
308
async get<T extends TToolset>(
309
userId: string,
310
slug: string,
311
options?: ToolsetOptions<TToolset>
312
): Promise<ReturnType<T['wrapTool']>>;
313
+
314
+ /**
315
+ * Get a list of tools by their slugs
316
+ * @param userId - The user id
317
+ * @param filters - The filters for the tools
318
+ * @param options - The options for the tools
319
+ * @returns The tools
320
+ *
321
+ * @example
322
+ * ```ts
323
+ * const tools = await composio.tools.get('default', {
324
+ * tools: ['github'],
325
+ * });
326
+ * ```
327
+ */
328
async get<T extends TToolset>(
329
userId: string,
330
filters: ToolListParams,
331
options?: ToolsetOptions<TToolset>
332
): Promise<ReturnType<T['wrapTools']>>;
333
+
334
+ /**
335
+ * Get a tool by its slug
336
+ * @param userId - The user id
337
+ * @param arg2 - The slug of the tool or the filters for the tools
338
+ * @param options - The options for the tools
339
+ * @returns The tool or the tools
340
+ */
341
async get(
342
userId: string,
343
arg2: ToolListParams | string,
@@ -317,6 +357,7 @@ export class Tools<
357
}
358
359
/**
360
+ * @internal
361
* Creates a function that executes a tool.
362
* This function is used by agentic the toolsets to execute the tool
363
* @param {string} userId - The user id
@@ -337,6 +378,14 @@ export class Tools<
378
return executeToolFn;
379
}
380
381
+ /**
382
+ * @internal
383
+ * Handles the execution of a custom tool
384
+ * @param tool - The tool to execute
385
+ * @param body - The body of the tool execution
386
+ * @param modifiers - The modifiers to be applied to the tool execution
387
+ * @returns The response from the tool execution
388
+ */
389
private async handleCustomToolExecution(
390
tool: Tool,
391
body: ToolExecuteParams,
@@ -370,6 +419,14 @@ export class Tools<
419
return result;
420
}
421
422
+ /**
423
+ * @internal
424
+ * Handles the execution of a composio tool
425
+ * @param tool - The tool to execute
426
+ * @param body - The body of the tool execution
427
+ * @param modifiers - The modifiers to be applied to the tool execution
428
+ * @returns The response from the tool execution
429
+ */
430
private async handleComposioToolExecution(
431
tool: Tool,
432
body: ToolExecuteParams,