Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Fix modifiers
haxzie committed
Jun 20, 2025 at 18:44 UTC
913c2c40817288bc42d36158763f4f9afb993d19
3 files changed
+7
-7
fern/pages/src/tool-calling/after-execution-modifiers.mdx
+2
-2
@@ -22,7 +22,7 @@ These modifiers are called after the tool is executed by the LLM. This allows yo
22
</Frame>
23
24
<Note>
25
- Below we use the `afterToolExecute` modifier to truncate the output of the `HACKERNEWS_GET_USER`
25
+ Below we use the `afterExecute` modifier to truncate the output of the `HACKERNEWS_GET_USER`
26
tool and only return the karma of the user.
27
</Note>
28
@@ -56,7 +56,7 @@ if (tool_calls) {
56
arguments: JSON.parse(toolArgs),
57
},
58
{
59
- afterToolExecute: (toolSlug, _, result) => {
59
+ afterExecute: ({ toolSlug, toolkitSlug, result }) => {
60
if (toolSlug === "HACKERNEWS_GET_USER") {
61
const { data } = result;
62
const { karma } = data.response_data as { karma: number };
fern/pages/src/tool-calling/before-execution-modifiers.mdx
+2
-2
@@ -22,7 +22,7 @@ These modifiers are called before the tool is executed by the LLM. This allows y
22
</Frame>
23
24
<Note>
25
- Below we use the `beforeToolExecute` modifier to modify the number of posts returned by the
25
+ Below we use the `beforeExecute` modifier to modify the number of posts returned by the
26
`HACKERNEWS_GET_LATEST_POSTS` tool.
27
</Note>
28
@@ -56,7 +56,7 @@ if (tool_calls) {
56
arguments: JSON.parse(toolArgs),
57
},
58
{
59
- beforeToolExecute: (toolSlug, _, params) => {
59
+ beforeExecute: { toolSlug, toolkitSlug, params }) => {
60
if (toolSlug === "HACKERNEWS_GET_LATEST_POSTS") {
61
params.arguments.size = 1;
62
}
fern/pages/src/tool-calling/schema-modifiers.mdx
+3
-3
@@ -35,15 +35,15 @@ const tools = await composio.tools.get(
35
tools: ["HACKERNEWS_GET_LATEST_POSTS", "HACKERNEWS_GET_USER"],
36
},
37
{
38
- modifyToolSchema: (toolSlug, _, toolSchema) => {
38
+ modifyToolSchema: ({ toolSlug, toolkitSlug, schema }) => {
39
if (toolSlug === "HACKERNEWS_GET_LATEST_POSTS") {
40
- const { inputParameters } = toolSchema;
40
+ const { inputParameters } = schema;
41
if (inputParameters?.properties) {
42
delete inputParameters.properties["page"];
43
}
44
inputParameters.required = ["size"];
45
}
46
- return toolSchema;
46
+ return schema;
47
},
48
}
49
);