1515use Mcp \Capability \Registry \ReferenceProviderInterface ;
1616use Mcp \Capability \Registry \ReferenceRegistryInterface ;
1717use Mcp \Capability \Resource \ResourceReaderInterface ;
18- use Mcp \Capability \Tool \ToolExecutorInterface ;
18+ use Mcp \Capability \Tool \ToolCallerInterface ;
1919use Mcp \Exception \ExceptionInterface ;
2020use Mcp \Exception \HandlerNotFoundException ;
2121use Mcp \Exception \InvalidInputMessageException ;
@@ -50,14 +50,16 @@ public function __construct(
5050 iterable $ methodHandlers ,
5151 private readonly LoggerInterface $ logger = new NullLogger (),
5252 ) {
53- $ this ->methodHandlers = $ methodHandlers instanceof \Traversable ? iterator_to_array ($ methodHandlers ) : $ methodHandlers ;
53+ $ this ->methodHandlers = $ methodHandlers instanceof \Traversable ? iterator_to_array (
54+ $ methodHandlers ,
55+ ) : $ methodHandlers ;
5456 }
5557
5658 public static function make (
5759 ReferenceRegistryInterface $ registry ,
5860 ReferenceProviderInterface $ referenceProvider ,
5961 Implementation $ implementation ,
60- ToolExecutorInterface $ toolExecutor ,
62+ ToolCallerInterface $ toolExecutor ,
6163 ResourceReaderInterface $ resourceReader ,
6264 PromptGetterInterface $ promptGetter ,
6365 LoggerInterface $ logger = new NullLogger (),
@@ -79,6 +81,12 @@ public static function make(
7981 );
8082 }
8183
84+ /**
85+ * @return iterable<string|null>
86+ *
87+ * @throws ExceptionInterface When a handler throws an exception during message processing
88+ * @throws \JsonException When JSON encoding of the response fails
89+ */
8290 public function process (string $ input ): iterable
8391 {
8492 $ this ->logger ->info ('Received message to process. ' , ['message ' => $ input ]);
@@ -109,7 +117,8 @@ public function process(string $input): iterable
109117 } catch (\DomainException ) {
110118 yield null ;
111119 } catch (NotFoundExceptionInterface $ e ) {
112- $ this ->logger ->warning (\sprintf ('Failed to create response: %s ' , $ e ->getMessage ()), ['exception ' => $ e ]);
120+ $ this ->logger ->warning (\sprintf ('Failed to create response: %s ' , $ e ->getMessage ()), ['exception ' => $ e ],
121+ );
113122
114123 yield $ this ->encodeResponse (Error::forMethodNotFound ($ e ->getMessage ()));
115124 } catch (\InvalidArgumentException $ e ) {
0 commit comments