33namespace Laravel \Boost \Mcp \Tools ;
44
55use Illuminate \Database \Eloquent \Model ;
6- use Illuminate \Support \Facades \Log ;
76use Laravel \Mcp \Server \Tool ;
87use Laravel \Mcp \Server \Tools \Annotations \IsReadOnly ;
98use Laravel \Mcp \Server \Tools \ToolInputSchema ;
1615#[IsReadOnly]
1716class ApplicationInfo extends Tool
1817{
19- public function __construct (protected Roster $ roster )
20- {
21- }
18+ public function __construct (protected Roster $ roster ) {}
2219
2320 public function description (): string
2421 {
@@ -31,15 +28,15 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
3128 }
3229
3330 /**
34- * @param array<string> $arguments
31+ * @param array<string> $arguments
3532 */
3633 public function handle (array $ arguments ): ToolResult
3734 {
3835 return ToolResult::json ([
3936 'php_version ' => PHP_VERSION ,
4037 'laravel_version ' => app ()->version (),
4138 'database_engine ' => config ('database.default ' ),
42- 'packages ' => $ this ->roster ->packages ()->map (fn (Package $ package ) => ['name ' => $ package ->name (), 'version ' => $ package ->version ()]),
39+ 'packages ' => $ this ->roster ->packages ()->map (fn (Package $ package ) => ['name ' => $ package ->name (), 'version ' => $ package ->version ()]),
4340 'models ' => $ this ->discoverModels (),
4441 ]);
4542 }
@@ -54,8 +51,8 @@ private function discoverModels(): array
5451 $ models = [];
5552 $ appPath = app_path ();
5653
57- if (!is_dir ($ appPath )) {
58- return ['app-path-isnt-a-directory: ' . $ appPath ];
54+ if (! is_dir ($ appPath )) {
55+ return ['app-path-isnt-a-directory: ' . $ appPath ];
5956 }
6057
6158 $ finder = Finder::create ()
@@ -66,17 +63,17 @@ private function discoverModels(): array
6663 foreach ($ finder as $ file ) {
6764 $ relativePath = $ file ->getRelativePathname ();
6865 $ namespace = app ()->getNamespace ();
69- $ className = $ namespace . str_replace (
70- ['/ ' , '.php ' ],
71- ['\\' , '' ],
72- $ relativePath
73- );
66+ $ className = $ namespace. str_replace (
67+ ['/ ' , '.php ' ],
68+ ['\\' , '' ],
69+ $ relativePath
70+ );
7471
7572 try {
7673 if (class_exists ($ className )) {
7774 $ reflection = new ReflectionClass ($ className );
78- if ($ reflection ->isSubclassOf (Model::class) && !$ reflection ->isAbstract ()) {
79- $ models [$ className ] = $ appPath . DIRECTORY_SEPARATOR . $ relativePath ;
75+ if ($ reflection ->isSubclassOf (Model::class) && ! $ reflection ->isAbstract ()) {
76+ $ models [$ className ] = $ appPath. DIRECTORY_SEPARATOR . $ relativePath ;
8077 }
8178 }
8279 } catch (\Throwable ) {
0 commit comments