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.

Update preprocessor examples

haxzie0da268ed5775
diff --git a/examples/pre-processors/src/index.ts b/examples/pre-processors/src/index.ts
index 114b62e59..e001269c8 100644
--- a/examples/pre-processors/src/index.ts
+++ b/examples/pre-processors/src/index.ts
@@ -40,21 +40,24 @@ const vercel = new Composio({
toolset: new VercelToolset(),
});
-vercel.tools.get(
- 'user-id',
+const agenticTools = await vercel.tools.get(
+ 'default',
// what is the type error i am getting here?
- { toolkits: [''] },
+ { tools: ['HACKERNEWS_GET_USER'] },
{
- // here for toolkitSlug and toolSlug before the generation mapping thing comes we should have basic generic that gets from the input type itself
- // so if i have toolkits then i get toolkit name and if i have tools then i get tool name
- modifyToolSchema: (toolSlug, toolSchema) => {
- return toolSchema;
- },
afterToolExecute: (toolSlug, result) => {
- // hmm i wonder about this
+ // modify the result
+ return result;
},
beforeToolExecute: (toolSlug, params) => {
- // here we should give a subset of params like userId should not be mutable here
+ // modify the params
+ return params;
+ },
+ modifyToolSchema: (toolSlug, toolSchema) => {
+ // modify the tool schema
+ return toolSchema;
},
}
);
+
+console.log(agenticTools);
diff --git a/packages/core/src/models/Tools.ts b/packages/core/src/models/Tools.ts
index e9d4c77c5..d62977d34 100644
--- a/packages/core/src/models/Tools.ts
+++ b/packages/core/src/models/Tools.ts
@@ -206,13 +206,14 @@ export class Tools<
}
const tools = await this.client.tools.list({
+ tool_slugs: queryParams.data.tools?.join(','),
+ toolkit_slug: queryParams.data.toolkits?.join(','),
cursor: queryParams.data.cursor,
important: queryParams.data.important,
limit: queryParams.data.limit,
search: queryParams.data.search,
- toolkit_slug: queryParams.data.toolkits?.join(','),
- tool_slugs: queryParams.data.tools?.join(','),
});
+
if (!tools) {
return [];
}
diff --git a/packages/core/src/types/tool.types.ts b/packages/core/src/types/tool.types.ts
index 80eff0017..406639c3b 100644
--- a/packages/core/src/types/tool.types.ts
+++ b/packages/core/src/types/tool.types.ts
@@ -56,12 +56,12 @@ export type ToolList = Array<Tool>;
* ToolListParams is the parameters for the list of tools.
*/
export const ToolListParamsSchema = z.object({
+ tools: z.array(z.string()).optional(),
cursor: z.string().optional(),
important: z.string().optional(),
limit: z.string().optional(),
search: z.string().optional(),
toolkits: z.array(z.string()).optional(),
- tools: z.array(z.string()).optional(),
});
export type ToolListParams = z.infer<typeof ToolListParamsSchema>;
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1b6500e3d..0feca778d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -123,8 +123,8 @@ importers:
specifier: ^1.3.16
version: 1.3.22([email protected])
'@composio/core':
- specifier: ^0.1.8-alpha.0
- version: 0.1.8-alpha.0([email protected])([email protected])
+ specifier: workspace:*
+ version: link:../../packages/core
'@composio/vercel':
specifier: workspace:*
version: link:../../packages/toolsets/vercel
@@ -6289,10 +6289,10 @@ snapshots:
- encoding
- ws
dependencies:
- '@composio/core': 0.1.0-rc.5([email protected])
+ '@composio/core': 0.1.0-rc.5([email protected])([email protected])
transitivePeerDependencies:
- encoding
- openai