@@ -73,6 +73,7 @@ import {
7373 CodebuffClient ,
7474 generateInitialRunState ,
7575 withAdditionalMessage ,
76+ getCustomToolDefinition ,
7677} from ' @codebuff/sdk'
7778
7879// Available after running `codebuff login`
@@ -124,23 +125,30 @@ const result = await client.run({
124125
125126 // Custom tool definitions
126127 customToolDefinitions: [
127- {
128+ getCustomToolDefinition ( {
128129 toolName: ' fetch_api_data' ,
129- zodSchema: z
130- .object ({
131- url: z .string ().url (),
132- method: z .enum ([' GET' , ' POST' ]).default (' GET' ),
133- headers: z .record (z .string ()).optional (),
134- })
135- .describe (' Fetch data from an API endpoint' ),
130+ description: ' Fetch data from an API endpoint' ,
131+ inputSchema: z .object ({
132+ url: z .string ().url (),
133+ method: z .enum ([' GET' , ' POST' ]).default (' GET' ),
134+ headers: z .record (z .string ()).optional (),
135+ }),
136+ exampleInputs: [
137+ { url: ' https://api.example.com/data' , method: ' GET' },
138+ {
139+ url: ' https://api.example.com/submit' ,
140+ method: ' POST' ,
141+ headers: { ' Content-Type' : ' application/json' },
142+ },
143+ ],
136144 handler : async ({ url , method , headers }) => {
137145 const response = await fetch (url , { method , headers })
138146 const data = await response .text ()
139147 return {
140- toolResultMessage: ` API Response: ${data .slice (0 , 500 )}... ` ,
148+ toolResultMessage: ` API Response: ${data .slice (0 , 5000 )}... ` ,
141149 }
142150 },
143- },
151+ }) ,
144152 ],
145153
146154 handleEvent : (event ) => {
0 commit comments