Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Add toolkit response schemas

haxzie03e57670b4dd
diff --git a/packages/core/src/models/Toolkits.ts b/packages/core/src/models/Toolkits.ts
index e6efa0168..ee80f8709 100644
--- a/packages/core/src/models/Toolkits.ts
+++ b/packages/core/src/models/Toolkits.ts
@@ -29,7 +29,7 @@ export class Toolkits implements InstrumentedInstance {
* This method fetches the toolkits from the Composio API.
* @returns {Promise<Toolkit[]>} List of toolkits
*/
- async list(
+ async getToolkits(
query: ToolkitListParams,
options?: RequestOptions
): Promise<ToolkitListResponse> {
@@ -43,7 +43,7 @@ export class Toolkits implements InstrumentedInstance {
* @param options - Request options
* @returns {Promise<ToolkitRetrieveResponse>} The toolkit object
*/
- async get(
+ async getToolkitBySlug(
slug: string,
options?: RequestOptions
): Promise<ToolkitRetrieveResponse> {
diff --git a/packages/core/src/types/toolkit.types.ts b/packages/core/src/types/toolkit.types.ts
new file mode 100644
index 000000000..4d60374ea
--- /dev/null
+++ b/packages/core/src/types/toolkit.types.ts
@@ -0,0 +1,110 @@
+import { optional, z } from 'zod';
+
+/**
+ * Toolkit list params
+ */
+export const ToolkitMangedByEnumSchema = z.enum(['all', 'composio_managed', 'project_managed']);
+export const ToolkitSortByEnumSchema = z.enum(['usage', 'alphabetically']);
+export const ToolkitsListParamsSchema = z.object({
+ category: z.string().optional(),
+ isLocal: z.boolean().optional(),
+ managedBy: ToolkitMangedByEnumSchema.optional(),
+ sortBy: ToolkitSortByEnumSchema.optional(),
+});
+
+export type ToolkitMangedByEnum = z.infer<typeof ToolkitMangedByEnumSchema>;
+export type ToolkitSortByEnum = z.infer<typeof ToolkitSortByEnumSchema>;
+export type ToolkitListParams = z.infer<typeof ToolkitsListParamsSchema>;
+
+
+/**
+ * Toolkits response
+ */
+export const ToolKitMetaSchema = z.object({
+ categories: z.array(z.object({
+ id: z.string(),
+ name: z.string(),
+ })),
+ createdAt: z.string(),
+ description: z.string(),
+ logo: z.string(),
+ toolsCount: z.number(),
+ triggersCount: z.number(),
+ updatedAt: z.string(),
+});
+export const ToolKitItemSchema = z.object({
+ id: z.string(),
+ name: z.string(),
+ slug: z.string(),
+ meta: ToolKitMetaSchema,
+ isLocalToolkit: z.boolean(),
+ authSchemes: z.array(z.string()).optional(),
+ composioManagedAuthSchemes: z.array(z.string()).optional(),
+ noAuth: z.boolean().optional(),
+});
+export const ToolKitListResponseSchema = z.object({
+ items: z.array(ToolKitItemSchema),
+ nextCursor: z.string().nullable(),
+ totalPages: z.number(),
+});
+
+export type ToolKitMeta = z.infer<typeof ToolKitMetaSchema>;
+export type ToolKitItem = z.infer<typeof ToolKitItemSchema>;
+export type ToolKitListResponse = z.infer<typeof ToolKitListResponseSchema>;
+
+
+/**
+ * Toolkit retrieve response
+ */
+export const ToolkitAuthFieldSchema = z.object({
+ name: z.string(),
+ displayName: z.string(),
+ type: z.string(),
+ default: z.string().nullable().optional(),
+});
+export const ToolkitAuthConfigDetailsSchema = z.object({
+ name: z.string(),
+ mode: z.string(),
+ fields: z.array(z.object({
+ authConfigCreation: z.object({
+ optional: z.array(ToolkitAuthFieldSchema),
+ required: z.array(ToolkitAuthFieldSchema),
+ }),
+ connectedAccountInitiation: z.object({
+ optional: z.array(ToolkitAuthFieldSchema),
+ required: z.array(ToolkitAuthFieldSchema),
+ }),
+ })),
+ proxy: z.object({
+ baseUrul: z.string(),
+ })
+});
+export const ToolkitRetrieveResponseSchema = z.object({
+ slug: z.string(),
+ name: z.string(),
+ meta: ToolKitMetaSchema,
+ isLocalToolkit: z.boolean(),
+ composioManagedAuthSchemes: z.array(z.string()).optional(),
+ authConfigDetails: z.array(ToolkitAuthConfigDetailsSchema).optional()
+});
+
+export type ToolkitAuthField = z.infer<typeof ToolkitAuthFieldSchema>;
+export type ToolkitAuthConfigDetails = z.infer<typeof ToolkitAuthConfigDetailsSchema>;
+export type ToolkitRetrieveResponse = z.infer<typeof ToolkitRetrieveResponseSchema>;
+
+
+/**
+ * Toolkit categories response
+ */
+export const ToolkitCategorySchema = z.object({
+ id: z.string(),
+ name: z.string(),
+});
+export const ToolkitRetrieveCategoriesResponseSchema = z.object({
+ items: z.array(ToolkitCategorySchema),
+ nextCursor: z.string().nullable(),
+ totalPages: z.number(),
+});
+
+export type ToolkitCategory = z.infer<typeof ToolkitCategorySchema>;
+export type ToolkitRetrieveCategoriesResponse = z.infer<typeof ToolkitRetrieveCategoriesResponseSchema>;
\ No newline at end of file