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
haxzie committed
May 5, 2025 at 20:05 UTC
03e57670b4dd3a515172c9ebb0a8ace7fadabbcd
2 files changed
+112
-2
packages/core/src/models/Toolkits.ts
+2
-2
@@ -29,7 +29,7 @@ export class Toolkits implements InstrumentedInstance {
29
* This method fetches the toolkits from the Composio API.
30
* @returns {Promise<Toolkit[]>} List of toolkits
31
*/
32
- async list(
32
+ async getToolkits(
33
query: ToolkitListParams,
34
options?: RequestOptions
35
): Promise<ToolkitListResponse> {
@@ -43,7 +43,7 @@ export class Toolkits implements InstrumentedInstance {
43
* @param options - Request options
44
* @returns {Promise<ToolkitRetrieveResponse>} The toolkit object
45
*/
46
- async get(
46
+ async getToolkitBySlug(
47
slug: string,
48
options?: RequestOptions
49
): Promise<ToolkitRetrieveResponse> {
packages/core/src/types/toolkit.types.ts
new
+110
@@ -0,0 +1,110 @@
1
+import { optional, z } from 'zod';
2
+
3
+/**
4
+ * Toolkit list params
5
+ */
6
+export const ToolkitMangedByEnumSchema = z.enum(['all', 'composio_managed', 'project_managed']);
7
+export const ToolkitSortByEnumSchema = z.enum(['usage', 'alphabetically']);
8
+export const ToolkitsListParamsSchema = z.object({
9
+ category: z.string().optional(),
10
+ isLocal: z.boolean().optional(),
11
+ managedBy: ToolkitMangedByEnumSchema.optional(),
12
+ sortBy: ToolkitSortByEnumSchema.optional(),
13
+});
14
+
15
+export type ToolkitMangedByEnum = z.infer<typeof ToolkitMangedByEnumSchema>;
16
+export type ToolkitSortByEnum = z.infer<typeof ToolkitSortByEnumSchema>;
17
+export type ToolkitListParams = z.infer<typeof ToolkitsListParamsSchema>;
18
+
19
+
20
+/**
21
+ * Toolkits response
22
+ */
23
+export const ToolKitMetaSchema = z.object({
24
+ categories: z.array(z.object({
25
+ id: z.string(),
26
+ name: z.string(),
27
+ })),
28
+ createdAt: z.string(),
29
+ description: z.string(),
30
+ logo: z.string(),
31
+ toolsCount: z.number(),
32
+ triggersCount: z.number(),
33
+ updatedAt: z.string(),
34
+});
35
+export const ToolKitItemSchema = z.object({
36
+ id: z.string(),
37
+ name: z.string(),
38
+ slug: z.string(),
39
+ meta: ToolKitMetaSchema,
40
+ isLocalToolkit: z.boolean(),
41
+ authSchemes: z.array(z.string()).optional(),
42
+ composioManagedAuthSchemes: z.array(z.string()).optional(),
43
+ noAuth: z.boolean().optional(),
44
+});
45
+export const ToolKitListResponseSchema = z.object({
46
+ items: z.array(ToolKitItemSchema),
47
+ nextCursor: z.string().nullable(),
48
+ totalPages: z.number(),
49
+});
50
+
51
+export type ToolKitMeta = z.infer<typeof ToolKitMetaSchema>;
52
+export type ToolKitItem = z.infer<typeof ToolKitItemSchema>;
53
+export type ToolKitListResponse = z.infer<typeof ToolKitListResponseSchema>;
54
+
55
+
56
+/**
57
+ * Toolkit retrieve response
58
+ */
59
+export const ToolkitAuthFieldSchema = z.object({
60
+ name: z.string(),
61
+ displayName: z.string(),
62
+ type: z.string(),
63
+ default: z.string().nullable().optional(),
64
+});
65
+export const ToolkitAuthConfigDetailsSchema = z.object({
66
+ name: z.string(),
67
+ mode: z.string(),
68
+ fields: z.array(z.object({
69
+ authConfigCreation: z.object({
70
+ optional: z.array(ToolkitAuthFieldSchema),
71
+ required: z.array(ToolkitAuthFieldSchema),
72
+ }),
73
+ connectedAccountInitiation: z.object({
74
+ optional: z.array(ToolkitAuthFieldSchema),
75
+ required: z.array(ToolkitAuthFieldSchema),
76
+ }),
77
+ })),
78
+ proxy: z.object({
79
+ baseUrul: z.string(),
80
+ })
81
+});
82
+export const ToolkitRetrieveResponseSchema = z.object({
83
+ slug: z.string(),
84
+ name: z.string(),
85
+ meta: ToolKitMetaSchema,
86
+ isLocalToolkit: z.boolean(),
87
+ composioManagedAuthSchemes: z.array(z.string()).optional(),
88
+ authConfigDetails: z.array(ToolkitAuthConfigDetailsSchema).optional()
89
+});
90
+
91
+export type ToolkitAuthField = z.infer<typeof ToolkitAuthFieldSchema>;
92
+export type ToolkitAuthConfigDetails = z.infer<typeof ToolkitAuthConfigDetailsSchema>;
93
+export type ToolkitRetrieveResponse = z.infer<typeof ToolkitRetrieveResponseSchema>;
94
+
95
+
96
+/**
97
+ * Toolkit categories response
98
+ */
99
+export const ToolkitCategorySchema = z.object({
100
+ id: z.string(),
101
+ name: z.string(),
102
+});
103
+export const ToolkitRetrieveCategoriesResponseSchema = z.object({
104
+ items: z.array(ToolkitCategorySchema),
105
+ nextCursor: z.string().nullable(),
106
+ totalPages: z.number(),
107
+});
108
+
109
+export type ToolkitCategory = z.infer<typeof ToolkitCategorySchema>;
110
+export type ToolkitRetrieveCategoriesResponse = z.infer<typeof ToolkitRetrieveCategoriesResponseSchema>;
\ No newline at end of file