File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,9 @@ public function message(Request $request): JsonResponse
7171
7272 try {
7373 $ result = match ($ method ) {
74+ 'initialize ' => $ this ->handleInitialize ($ params ),
75+ 'notifications/initialized ' => new \stdClass ,
76+ 'ping ' => new \stdClass ,
7477 'tools/list ' => ['tools ' => $ this ->getToolDefinitions ()],
7578 'tools/call ' => $ this ->handleToolCall ($ params ['name ' ] ?? '' , $ params ['arguments ' ] ?? []),
7679 default => throw new \InvalidArgumentException ("Unknown method: {$ method }" ),
@@ -238,6 +241,20 @@ protected function getToolDefinitions(): array
238241 ];
239242 }
240243
244+ protected function handleInitialize (array $ params ): array
245+ {
246+ return [
247+ 'protocolVersion ' => '2024-11-05 ' ,
248+ 'capabilities ' => [
249+ 'tools ' => new \stdClass ,
250+ ],
251+ 'serverInfo ' => [
252+ 'name ' => 'nativephp-docs ' ,
253+ 'version ' => '1.0.0 ' ,
254+ ],
255+ ];
256+ }
257+
241258 protected function handleToolCall (string $ name , array $ args ): array
242259 {
243260 return match ($ name ) {
You can’t perform that action at this time.
0 commit comments