@@ -195,105 +195,5 @@ public IEnumerator MCP_Tools()
195195 }
196196 Assert . IsTrue ( toolNames . Count > 0 , "No tools found in the response" ) ;
197197 }
198-
199- [ UnityTest ]
200- public IEnumerator MCP_Tools_WithInputArgs_InputSchema_HasTypeObject ( )
201- {
202- var task = UnityMcpPluginEditor . Instance . Tools ! . RunListTool ( new RequestListTool ( ) ) ;
203- while ( ! task . IsCompleted )
204- {
205- yield return null ;
206- }
207- var toolResponse = task . Result ;
208- var tools = toolResponse . Value ;
209-
210- Assert . IsNotNull ( tools , "Tool response is null" ) ;
211- Assert . IsNotEmpty ( tools , "Tool response is empty" ) ;
212-
213- foreach ( var tool in tools ! )
214- {
215- var schema = JsonNode . Parse ( tool . InputSchema . ToString ( ) ) ;
216-
217- if ( schema is not JsonObject schemaObject )
218- {
219- UnityEngine . Debug . Log ( $ "Skipping tool '{ tool . Name } ': InputSchema is not a JsonObject") ;
220- continue ;
221- }
222-
223- // Filter out tools with no input arguments
224- var hasInputArgs = schemaObject . TryGetPropertyValue ( JsonSchema . Properties , out var propertiesNode )
225- && propertiesNode is JsonObject propertiesObject
226- && propertiesObject . Count > 0 ;
227-
228- if ( ! hasInputArgs )
229- {
230- UnityEngine . Debug . Log ( $ "Skipping tool '{ tool . Name } ': no input arguments") ;
231- continue ;
232- }
233-
234- // Tools with input arguments must have "type": "object" in InputSchema
235- UnityEngine . Debug . Log ( $ "Validating tool '{ tool . Name } ' InputSchema: { schema } ") ;
236-
237- Assert . IsTrue (
238- schemaObject . TryGetPropertyValue ( JsonSchema . Type , out var typeNode ) ,
239- $ "Tool '{ tool . Name } ' has input arguments but InputSchema is missing '{ JsonSchema . Type } ' property. Schema:\n { schema } "
240- ) ;
241- Assert . AreEqual (
242- "object" ,
243- typeNode ? . ToString ( ) ,
244- $ "Tool '{ tool . Name } ' InputSchema '{ JsonSchema . Type } ' is not 'object'. Schema:\n { schema } "
245- ) ;
246- }
247- }
248-
249- [ UnityTest ]
250- public IEnumerator MCP_Tools_WithNoInputArgs_InputSchema_HasTypeObject ( )
251- {
252- var task = UnityMcpPluginEditor . Instance . Tools ! . RunListTool ( new RequestListTool ( ) ) ;
253- while ( ! task . IsCompleted )
254- {
255- yield return null ;
256- }
257- var toolResponse = task . Result ;
258- var tools = toolResponse . Value ;
259-
260- Assert . IsNotNull ( tools , "Tool response is null" ) ;
261- Assert . IsNotEmpty ( tools , "Tool response is empty" ) ;
262-
263- foreach ( var tool in tools ! )
264- {
265- var schema = JsonNode . Parse ( tool . InputSchema . ToString ( ) ) ;
266-
267- if ( schema is not JsonObject schemaObject )
268- {
269- UnityEngine . Debug . Log ( $ "Skipping tool '{ tool . Name } ': InputSchema is not a JsonObject") ;
270- continue ;
271- }
272-
273- // Only test tools with no input arguments
274- var hasInputArgs = schemaObject . TryGetPropertyValue ( JsonSchema . Properties , out var propertiesNode )
275- && propertiesNode is JsonObject propertiesObject
276- && propertiesObject . Count > 0 ;
277-
278- if ( hasInputArgs )
279- {
280- UnityEngine . Debug . Log ( $ "Skipping tool '{ tool . Name } ': has input arguments") ;
281- continue ;
282- }
283-
284- // Tools with no input arguments must still have "type": "object" in InputSchema
285- UnityEngine . Debug . Log ( $ "Validating tool '{ tool . Name } ' InputSchema: { schema } ") ;
286-
287- Assert . IsTrue (
288- schemaObject . TryGetPropertyValue ( JsonSchema . Type , out var typeNode ) ,
289- $ "Tool '{ tool . Name } ' has no input arguments but InputSchema is missing '{ JsonSchema . Type } ' property. Schema:\n { schema } "
290- ) ;
291- Assert . AreEqual (
292- "object" ,
293- typeNode ? . ToString ( ) ,
294- $ "Tool '{ tool . Name } ' InputSchema '{ JsonSchema . Type } ' is not 'object'. Schema:\n { schema } "
295- ) ;
296- }
297- }
298198 }
299199}
0 commit comments