77 maxIterations ,
88 type Tool ,
99} from '@tanstack/ai'
10+ import { z } from 'zod'
1011import { createAnthropic } from '@tanstack/ai-anthropic'
1112import { createGemini } from '@tanstack/ai-gemini'
1213import { ollama } from '@tanstack/ai-ollama'
@@ -110,23 +111,15 @@ async function testTemperatureTool(
110111 const expectedLocation = 'San Francisco'
111112
112113 const temperatureTool = tool ( {
113- type : 'function' ,
114- function : {
115- name : 'get_temperature' ,
116- description :
117- 'Get the current temperature in degrees for a specific location' ,
118- parameters : {
119- type : 'object' ,
120- properties : {
121- location : {
122- type : 'string' ,
123- description : 'The city or location to get the temperature for' ,
124- } ,
125- } ,
126- required : [ 'location' ] ,
127- } ,
128- } ,
129- execute : async ( args : any ) => {
114+ name : 'get_temperature' ,
115+ description :
116+ 'Get the current temperature in degrees for a specific location' ,
117+ inputSchema : z . object ( {
118+ location : z
119+ . string ( )
120+ . describe ( 'The city or location to get the temperature for' ) ,
121+ } ) ,
122+ execute : async ( args ) => {
130123 toolExecuteCalled = true
131124 toolExecuteCallCount ++
132125 const callInfo : any = {
@@ -246,24 +239,14 @@ async function testApprovalToolFlow(
246239 error ?: string
247240 } > = [ ]
248241
249- const addToCartTool : Tool = {
250- type : 'function' ,
251- function : {
252- name : 'addToCart' ,
253- description : 'Add an item to the shopping cart' ,
254- parameters : {
255- type : 'object' ,
256- properties : {
257- item : {
258- type : 'string' ,
259- description : 'The name of the item to add to the cart' ,
260- } ,
261- } ,
262- required : [ 'item' ] ,
263- } ,
264- } ,
242+ const addToCartTool : Tool = tool ( {
243+ name : 'addToCart' ,
244+ description : 'Add an item to the shopping cart' ,
245+ inputSchema : z . object ( {
246+ item : z . string ( ) . describe ( 'The name of the item to add to the cart' ) ,
247+ } ) ,
265248 needsApproval : true ,
266- execute : async ( args : any ) => {
249+ execute : async ( args ) => {
267250 toolExecuteCalled = true
268251 toolExecuteCallCount ++
269252 const callInfo : any = {
@@ -281,7 +264,7 @@ async function testApprovalToolFlow(
281264 throw error
282265 }
283266 } ,
284- }
267+ } )
285268
286269 const messages = [
287270 {
0 commit comments