33namespace Laravel \Boost \Mcp \Tools ;
44
55use Illuminate \Support \Facades \Cache ;
6- use Illuminate \Support \Facades \Log ;
76use Illuminate \Support \Str ;
87use Laravel \Boost \Concerns \MakesHttpRequests ;
98use Laravel \Mcp \Server \Tool ;
@@ -19,13 +18,11 @@ class GetInertiaDoc extends Tool
1918{
2019 use MakesHttpRequests;
2120
22- public function __construct (protected Roster $ roster )
23- {
24- }
21+ public function __construct (protected Roster $ roster ) {}
2522
2623 public function description (): string
2724 {
28- return 'Fetch the contents of a single Inertia documentation file matching the installed major Inertia version. ' . PHP_EOL .
25+ return 'Fetch the contents of a single Inertia documentation file matching the installed major Inertia version. ' . PHP_EOL .
2926 'It \'s critical you use this and the list-inertia-docs tool to get the correct documentation for this application. ' ;
3027 }
3128
@@ -39,7 +36,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
3936 }
4037
4138 /**
42- * @param array<string> $arguments
39+ * @param array<string> $arguments
4340 */
4441 public function handle (array $ arguments ): ToolResult
4542 {
@@ -48,16 +45,16 @@ public function handle(array $arguments): ToolResult
4845 return ToolResult::error ('The "filename" argument is required. ' );
4946 }
5047
51- if (!Str::endsWith ($ filename , '.jsx ' )) {
48+ if (! Str::endsWith ($ filename , '.jsx ' )) {
5249 return ToolResult::error ('The "filename" argument must end with ".jsx". ' );
5350 }
5451
55- if (!preg_match ('/^[a-z0-9-]+\.jsx$/ ' , $ filename )) {
52+ if (! preg_match ('/^[a-z0-9-]+\.jsx$/ ' , $ filename )) {
5653 return ToolResult::error ('The "filename" argument must be a valid filename (e.g. "installation.jsx"). ' );
5754 }
5855
5956 [$ ref , $ shouldProceed ] = $ this ->determineVersionRef ();
60- if (!$ shouldProceed ) {
57+ if (! $ shouldProceed ) {
6158 return ToolResult::error ('Inertia is not installed in this project. ' );
6259 }
6360
@@ -70,14 +67,14 @@ public function handle(array $arguments): ToolResult
7067 /** @var \Illuminate\Http\Client\Response $response */
7168 $ response = $ this ->client ()->get ($ url );
7269
73- if (!$ response ->successful ()) {
74- return ToolResult::error ('Failed to fetch Inertia doc: ' . $ response ->body ());
70+ if (! $ response ->successful ()) {
71+ return ToolResult::error ('Failed to fetch Inertia doc: ' . $ response ->body ());
7572 }
7673
7774 /** @var array<string,mixed> $data */
7875 $ data = json_decode ($ response ->body (), true , 512 , JSON_THROW_ON_ERROR );
7976
80- if (($ data ['type ' ] ?? '' ) !== 'file ' || !isset ($ data ['content ' ])) {
77+ if (($ data ['type ' ] ?? '' ) !== 'file ' || ! isset ($ data ['content ' ])) {
8178 return ToolResult::error ('Unexpected response structure when fetching Inertia doc. ' );
8279 }
8380
@@ -118,7 +115,7 @@ private function determineVersionRef(): array
118115 return ['v1 ' , false ];
119116 }
120117
121- return ['v ' . $ package ->majorVersion (), true ];
118+ return ['v ' . $ package ->majorVersion (), true ];
122119 }
123120
124121 public function shouldRegister (): bool
0 commit comments