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

next
ts 65 lines 2.23 KB
Raw
1 import { Schema } from 'effect';
2 import { JSONTransformSchema } from './utils/json-transform-schema';
3
4 export const ToolAsEnum = Schema.String.annotate({ identifier: 'ToolAsEnum' });
5 export type ToolAsEnum = Schema.Schema.Type<typeof ToolAsEnum>;
6
7 export const ToolsAsEnums = Schema.Array(ToolAsEnum).annotate({
8 identifier: 'Array<ToolAsEnum>',
9 message: 'Expected an array of strings',
10 });
11 export type ToolsAsEnums = Schema.Schema.Type<typeof ToolsAsEnums>;
12
13 export const ToolsAsEnumsJSON = JSONTransformSchema(ToolsAsEnums);
14 export const toolsAsEnumsFromJSON = Schema.decodeEffect(ToolsAsEnumsJSON);
15 export const toolsAsEnumsToJSON = Schema.encodeEffect(ToolsAsEnumsJSON);
16
17 /**
18 * Tool with payload
19 */
20 export const Tool = Schema.Struct({
21 /**
22 * List of available versions of this tool
23 */
24 available_versions: Schema.Array(Schema.String),
25 /**
26 * Human-readable display name of the tool
27 */
28 name: Schema.String,
29 /**
30 * Unique identifier for the tool
31 */
32 slug: ToolAsEnum,
33 /**
34 * Schema definition of required input parameters for the tool
35 */
36 input_parameters: Schema.Record(Schema.String, Schema.Unknown),
37 /**
38 * Schema definition of required output parameters for the tool
39 */
40 output_parameters: Schema.Record(Schema.String, Schema.Unknown),
41 /**
42 * Detailed explanation of the tool's functionality and purpose.
43 */
44 description: Schema.String,
45 /**
46 * List of tags associated with the tool for categorization and filtering.
47 */
48 tags: Schema.Array(Schema.String),
49 }).annotate({ identifier: 'Tool' });
50 export type Tool = Schema.Schema.Type<typeof Tool>;
51
52 export const Tools = Schema.Array(Tool).annotate({ identifier: 'Array<Tool>' });
53 export type Tools = Schema.Schema.Type<typeof Tools>;
54
55 export const ToolsJSON = JSONTransformSchema(Tools);
56 export const ToolsFromJSON = Schema.decodeEffect(ToolsJSON);
57 export const ToolsToJSON = Schema.encodeEffect(ToolsJSON);
58
59 // The client does not type the latest-version endpoint, so the CLI owns its
60 // response contract.
61 export const LatestToolVersionResponse = Schema.Struct({
62 tool_slug: Schema.String,
63 version: Schema.String,
64 }).annotate({ identifier: 'LatestToolVersionResponse' });
65 export type LatestToolVersionResponse = Schema.Schema.Type<typeof LatestToolVersionResponse>;