@@ -161,10 +161,12 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
161161 config ??= { sessionIdGenerator : ( ) => randomUUID ( ) } ;
162162 const mcpServer = new McpServer ( { name : 'test-server' , version : '1.0.0' } , { capabilities : { logging : { } } } ) ;
163163
164- mcpServer . tool (
164+ mcpServer . registerTool (
165165 'greet' ,
166- 'A simple greeting tool' ,
167- { name : z . string ( ) . describe ( 'Name to greet' ) } ,
166+ {
167+ description : 'A simple greeting tool' ,
168+ inputSchema : { name : z . string ( ) . describe ( 'Name to greet' ) }
169+ } ,
168170 async ( { name } ) : Promise < CallToolResult > => {
169171 return { content : [ { type : 'text' , text : `Hello, ${ name } !` } ] } ;
170172 }
@@ -206,10 +208,12 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
206208 } > {
207209 const mcpServer = new McpServer ( { name : 'test-server' , version : '1.0.0' } , { capabilities : { logging : { } } } ) ;
208210
209- mcpServer . tool (
211+ mcpServer . registerTool (
210212 'profile' ,
211- 'A user profile data tool' ,
212- { active : z . boolean ( ) . describe ( 'Profile status' ) } ,
213+ {
214+ description : 'A user profile data tool' ,
215+ inputSchema : { active : z . boolean ( ) . describe ( 'Profile status' ) }
216+ } ,
213217 async ( { active } , { authInfo } ) : Promise < CallToolResult > => {
214218 return { content : [ { type : 'text' , text : `${ active ? 'Active' : 'Inactive' } profile from token: ${ authInfo ?. token } !` } ] } ;
215219 }
@@ -394,10 +398,12 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
394398 it ( 'should pass request info to tool callback' , async ( ) => {
395399 sessionId = await initializeServer ( ) ;
396400
397- mcpServer . tool (
401+ mcpServer . registerTool (
398402 'test-request-info' ,
399- 'A simple test tool with request info' ,
400- { name : z . string ( ) . describe ( 'Name to greet' ) } ,
403+ {
404+ description : 'A simple test tool with request info' ,
405+ inputSchema : { name : z . string ( ) . describe ( 'Name to greet' ) }
406+ } ,
401407 async ( { name } , { requestInfo } ) : Promise < CallToolResult > => {
402408 // Convert Headers object to plain object for JSON serialization
403409 // Headers is a Web API class that doesn't serialize with JSON.stringify
@@ -1845,7 +1851,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
18451851 } ) ;
18461852
18471853 // Register a tool that closes its own SSE stream via extra callback
1848- mcpServer . tool ( 'close-stream-tool' , 'Closes its own stream' , { } , async ( _args , extra ) => {
1854+ mcpServer . registerTool ( 'close-stream-tool' , { description : 'Closes its own stream' } , async extra => {
18491855 // Close the SSE stream for this request
18501856 extra . closeSSEStream ?.( ) ;
18511857 streamCloseCalled = true ;
@@ -1913,7 +1919,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
19131919 let receivedCloseSSEStream : ( ( ) => void ) | undefined ;
19141920
19151921 // Register a tool that captures the extra.closeSSEStream callback
1916- mcpServer . tool ( 'test-callback-tool' , 'Test tool' , { } , async ( _args , extra ) => {
1922+ mcpServer . registerTool ( 'test-callback-tool' , { description : 'Test tool' } , async extra => {
19171923 receivedCloseSSEStream = extra . closeSSEStream ;
19181924 return { content : [ { type : 'text' , text : 'Done' } ] } ;
19191925 } ) ;
@@ -1972,7 +1978,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
19721978 let receivedCloseStandaloneSSEStream : ( ( ) => void ) | undefined ;
19731979
19741980 // Register a tool that captures the extra.closeSSEStream callback
1975- mcpServer . tool ( 'test-old-version-tool' , 'Test tool' , { } , async ( _args , extra ) => {
1981+ mcpServer . registerTool ( 'test-old-version-tool' , { description : 'Test tool' } , async extra => {
19761982 receivedCloseSSEStream = extra . closeSSEStream ;
19771983 receivedCloseStandaloneSSEStream = extra . closeStandaloneSSEStream ;
19781984 return { content : [ { type : 'text' , text : 'Done' } ] } ;
@@ -2031,7 +2037,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
20312037 let receivedCloseSSEStream : ( ( ) => void ) | undefined ;
20322038
20332039 // Register a tool that captures the extra.closeSSEStream callback
2034- mcpServer . tool ( 'test-no-callback-tool' , 'Test tool' , { } , async ( _args , extra ) => {
2040+ mcpServer . registerTool ( 'test-no-callback-tool' , { description : 'Test tool' } , async extra => {
20352041 receivedCloseSSEStream = extra . closeSSEStream ;
20362042 return { content : [ { type : 'text' , text : 'Done' } ] } ;
20372043 } ) ;
@@ -2088,7 +2094,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
20882094 let receivedCloseStandaloneSSEStream : ( ( ) => void ) | undefined ;
20892095
20902096 // Register a tool that captures the extra.closeStandaloneSSEStream callback
2091- mcpServer . tool ( 'test-standalone-callback-tool' , 'Test tool' , { } , async ( _args , extra ) => {
2097+ mcpServer . registerTool ( 'test-standalone-callback-tool' , { description : 'Test tool' } , async extra => {
20922098 receivedCloseStandaloneSSEStream = extra . closeStandaloneSSEStream ;
20932099 return { content : [ { type : 'text' , text : 'Done' } ] } ;
20942100 } ) ;
@@ -2143,7 +2149,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
21432149 mcpServer = result . mcpServer ;
21442150
21452151 // Register a tool that closes the standalone SSE stream via extra callback
2146- mcpServer . tool ( 'close-standalone-stream-tool' , 'Closes standalone stream' , { } , async ( _args , extra ) => {
2152+ mcpServer . registerTool ( 'close-standalone-stream-tool' , { description : 'Closes standalone stream' } , async extra => {
21472153 extra . closeStandaloneSSEStream ?.( ) ;
21482154 return { content : [ { type : 'text' , text : 'Stream closed' } ] } ;
21492155 } ) ;
@@ -2224,7 +2230,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
22242230 mcpServer = result . mcpServer ;
22252231
22262232 // Register a tool that closes the standalone SSE stream
2227- mcpServer . tool ( 'close-standalone-for-reconnect' , 'Closes standalone stream' , { } , async ( _args , extra ) => {
2233+ mcpServer . registerTool ( 'close-standalone-for-reconnect' , { description : 'Closes standalone stream' } , async extra => {
22282234 extra . closeStandaloneSSEStream ?.( ) ;
22292235 return { content : [ { type : 'text' , text : 'Stream closed' } ] } ;
22302236 } ) ;
0 commit comments