@@ -102,17 +102,17 @@ describe('formatAllValidationErrors', () => {
102102describe ( 'patchValidateToolInput' , ( ) => {
103103 it ( 'should override validateToolInput on the server instance' , ( ) => {
104104 const server = new McpServer ( { name : 'test' , version : '1.0.0' } ) ;
105-
105+
106106 const original = ( server as any ) . validateToolInput ;
107107 patchValidateToolInput ( server ) ;
108-
108+
109109 expect ( ( server as any ) . validateToolInput ) . not . toBe ( original ) ;
110110 } ) ;
111111
112112 it ( 'should return undefined when tool has no inputSchema' , async ( ) => {
113113 const server = new McpServer ( { name : 'test' , version : '1.0.0' } ) ;
114114 patchValidateToolInput ( server ) ;
115-
115+
116116 const result = await ( server as any ) . validateToolInput ( { } , { } , 'test_tool' ) ;
117117 expect ( result ) . toBeUndefined ( ) ;
118118 } ) ;
@@ -123,7 +123,7 @@ describe('patchValidateToolInput', () => {
123123 const tool = {
124124 inputSchema : { owner : z . string ( ) , repo : z . string ( ) } ,
125125 } ;
126-
126+
127127 const result = await ( server as any ) . validateToolInput (
128128 tool ,
129129 { owner : 'octocat' , repo : 'hello-world' } ,
@@ -138,7 +138,7 @@ describe('patchValidateToolInput', () => {
138138 const tool = {
139139 inputSchema : z . object ( { owner : z . string ( ) , repo : z . string ( ) } ) ,
140140 } ;
141-
141+
142142 const result = await ( server as any ) . validateToolInput (
143143 tool ,
144144 { owner : 'octocat' , repo : 'hello-world' } ,
@@ -158,7 +158,7 @@ describe('patchValidateToolInput', () => {
158158 } ,
159159 } ;
160160 try {
161-
161+
162162 await ( server as any ) . validateToolInput ( tool , { } , 'audit_store_findings' ) ;
163163 expect . fail ( 'Should have thrown' ) ;
164164 } catch ( error : unknown ) {
@@ -181,7 +181,7 @@ describe('patchValidateToolInput', () => {
181181 } ) ,
182182 } ;
183183 try {
184-
184+
185185 await ( server as any ) . validateToolInput ( tool , { } , 'annotation_create' ) ;
186186 expect . fail ( 'Should have thrown' ) ;
187187 } catch ( error : unknown ) {
@@ -200,7 +200,7 @@ describe('patchValidateToolInput', () => {
200200 inputSchema : { owner : z . string ( ) , repo : z . string ( ) . optional ( ) } ,
201201 } ;
202202 try {
203-
203+
204204 await ( server as any ) . validateToolInput ( tool , { } , 'test_tool' ) ;
205205 expect . fail ( 'Should have thrown' ) ;
206206 } catch ( error : unknown ) {
@@ -220,7 +220,7 @@ describe('patchValidateToolInput', () => {
220220 } ,
221221 } ;
222222 try {
223-
223+
224224 await ( server as any ) . validateToolInput (
225225 tool ,
226226 { count : 'not-a-number' } ,
@@ -234,17 +234,16 @@ describe('patchValidateToolInput', () => {
234234 }
235235 } ) ;
236236
237- it ( 'should pass through args for unrecognized schema types' , async ( ) => {
237+ it ( 'should delegate to original validateToolInput for unrecognized schema types' , async ( ) => {
238238 const server = new McpServer ( { name : 'test' , version : '1.0.0' } ) ;
239239 patchValidateToolInput ( server ) ;
240240 const tool = { inputSchema : 'not-a-zod-schema' } ;
241-
242- const result = await ( server as any ) . validateToolInput (
243- tool ,
244- { foo : 'bar' } ,
245- 'test_tool' ,
246- ) ;
247- expect ( result ) . toEqual ( { foo : 'bar' } ) ;
241+
242+ // The original SDK validateToolInput will attempt to parse and may
243+ // throw or return — either way, validation is not silently skipped.
244+ await expect (
245+ ( server as any ) . validateToolInput ( tool , { foo : 'bar' } , 'test_tool' ) ,
246+ ) . rejects . toThrow ( ) ;
248247 } ) ;
249248} ) ;
250249
0 commit comments