@@ -47,17 +47,22 @@ public function load(RegistryInterface $registry): void
4747 foreach ($ resource ->getMcp () ?? [] as $ mcp ) {
4848 if ($ mcp instanceof McpTool) {
4949 $ inputClass = $ mcp ->getInput ()['class ' ] ?? $ mcp ->getClass ();
50- $ schema = $ this ->schemaFactory ->buildSchema ($ inputClass , 'json ' , Schema::TYPE_INPUT , $ mcp , null , [SchemaFactory::FORCE_SUBSCHEMA => true ]);
51- $ outputSchema = $ this ->schemaFactory ->buildSchema ($ inputClass , 'json ' , Schema::TYPE_OUTPUT , $ mcp , null , [SchemaFactory::FORCE_SUBSCHEMA => true ]);
50+ $ inputFormat = array_first ($ mcp ->getInputFormats () ?? ['json ' ]);
51+ $ inputSchema = $ this ->schemaFactory ->buildSchema ($ inputClass , $ inputFormat , Schema::TYPE_INPUT , $ mcp , null , [SchemaFactory::FORCE_SUBSCHEMA => true ]);
52+
53+ $ outputClass = $ mcp ->getOutput ()['class ' ] ?? $ mcp ->getClass ();
54+ $ outputFormat = array_first ($ mcp ->getOutputFormats () ?? ['jsonld ' ]);
55+ $ outputSchema = $ this ->schemaFactory ->buildSchema ($ outputClass , $ outputFormat , Schema::TYPE_OUTPUT , $ mcp , null , [SchemaFactory::FORCE_SUBSCHEMA => true ]);
56+
5257 $ registry ->registerTool (
5358 new Tool (
5459 name: $ mcp ->getName (),
55- inputSchema: $ schema ->getDefinitions ()[$ schema ->getRootDefinitionKey ()]->getArrayCopy (),
60+ inputSchema: $ inputSchema ->getDefinitions ()[$ inputSchema ->getRootDefinitionKey ()]->getArrayCopy (),
5661 description: $ mcp ->getDescription (),
5762 annotations: $ mcp ->getAnnotations () ? ToolAnnotations::fromArray ($ mcp ->getAnnotations ()) : null ,
5863 icons: $ mcp ->getIcons (),
5964 meta: $ mcp ->getMeta (),
60- outputSchema: $ outputSchema ->getDefinitions ()[ $ outputSchema -> getRootDefinitionKey ()]-> getArrayCopy (),
65+ outputSchema: $ outputSchema ->getArrayCopy (),
6166 ),
6267 self ::HANDLER ,
6368 true ,
0 commit comments