Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Formatting
Signed-off-by: Pushpak Chhajed <[email protected]>
  • Loading branch information
pushpak1300 committed Dec 15, 2025
commit ba1c52e26a90a1b196d9eef3f0459c570042de85
8 changes: 4 additions & 4 deletions src/Mcp/Boost.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use InvalidArgumentException;
use Laravel\Boost\Mcp\Methods\CallToolWithExecutor;
use Laravel\Boost\Mcp\Prompts\ThirdPartyPrompt;
use Laravel\Boost\Mcp\Resources\ThirdPartyResource;
use Laravel\Boost\Mcp\Prompts\PackageGuidelinePrompt;
use Laravel\Boost\Mcp\Resources\PackageGuidelineResource;
use Laravel\Boost\Mcp\Tools\ApplicationInfo;
use Laravel\Boost\Mcp\Tools\BrowserLogs;
use Laravel\Boost\Mcp\Tools\DatabaseConnections;
Expand Down Expand Up @@ -141,8 +141,8 @@ protected function discoverPrompts(): array
private function discoverThirdPartyPrimitives(string $primitiveType): array
{
$primitiveClass = match ($primitiveType) {
Prompt::class => ThirdPartyPrompt::class,
Resource::class => ThirdPartyResource::class,
Prompt::class => PackageGuidelinePrompt::class,
Resource::class => PackageGuidelineResource::class,
default => throw new InvalidArgumentException('Invalid Primitive Type'),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Laravel\Mcp\Response;
use Laravel\Mcp\Server\Prompt;

class ThirdPartyPrompt extends Prompt
class PackageGuidelinePrompt extends Prompt
{
use RendersBladeGuidelines;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Laravel\Mcp\Response;
use Laravel\Mcp\Server\Resource;

class ThirdPartyResource extends Resource
class PackageGuidelineResource extends Resource
{
use RendersBladeGuidelines;

Expand Down
16 changes: 8 additions & 8 deletions tests/Feature/Mcp/Prompts/BladePromptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use Laravel\Boost\Mcp\Prompts\ThirdPartyPrompt;
use Laravel\Boost\Mcp\Prompts\PackageGuidelinePrompt;

beforeEach(function (): void {
$this->testBladePath = sys_get_temp_dir().'/test-guideline.blade.php';
Expand All @@ -22,7 +22,7 @@
});

it('renders a blade file as a prompt', function (): void {
$prompt = new ThirdPartyPrompt('acme/payments', $this->testBladePath);
$prompt = new PackageGuidelinePrompt('acme/payments', $this->testBladePath);

$response = $prompt->handle();

Expand All @@ -34,14 +34,14 @@
});

it('generates correct metadata from the package name', function (): void {
$prompt = new ThirdPartyPrompt('acme/payments', $this->testBladePath);
$prompt = new PackageGuidelinePrompt('acme/payments', $this->testBladePath);

expect($prompt->name())->toBe('acme/payments')
->and($prompt->description())->toBe('Guidelines for acme/payments');
});

it('handles a non-existent blade file gracefully', function (): void {
$prompt = new ThirdPartyPrompt('acme/test', '/non/existent/path.blade.php');
$prompt = new PackageGuidelinePrompt('acme/test', '/non/existent/path.blade.php');

$response = $prompt->handle();

Expand All @@ -61,7 +61,7 @@

file_put_contents($this->testBladePath, $bladeContent);

$prompt = new ThirdPartyPrompt('test/package', $this->testBladePath);
$prompt = new PackageGuidelinePrompt('test/package', $this->testBladePath);
$response = $prompt->handle();

expect($response)->isToolResult()
Expand All @@ -80,7 +80,7 @@

file_put_contents($this->testBladePath, $bladeContent);

$prompt = new ThirdPartyPrompt('test/package', $this->testBladePath);
$prompt = new PackageGuidelinePrompt('test/package', $this->testBladePath);
$response = $prompt->handle();

expect($response)->isToolResult()
Expand All @@ -99,7 +99,7 @@ function example() {

file_put_contents($this->testBladePath, $bladeContent);

$prompt = new ThirdPartyPrompt('test/package', $this->testBladePath);
$prompt = new PackageGuidelinePrompt('test/package', $this->testBladePath);
$response = $prompt->handle();

expect($response)->isToolResult()
Expand All @@ -118,7 +118,7 @@ function example() {

file_put_contents($this->testBladePath, $bladeContent);

$prompt = new ThirdPartyPrompt('test/package', $this->testBladePath);
$prompt = new PackageGuidelinePrompt('test/package', $this->testBladePath);

$response1 = $prompt->handle();
$content1 = (string) $response1->content();
Expand Down
20 changes: 10 additions & 10 deletions tests/Feature/Mcp/Resources/ThirdPartyResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use Laravel\Boost\Mcp\Resources\ThirdPartyResource;
use Laravel\Boost\Mcp\Resources\PackageGuidelineResource;

beforeEach(function (): void {
$this->testBladePath = sys_get_temp_dir().'/test-resource-guideline.blade.php';
Expand All @@ -22,25 +22,25 @@
});

test('it generates resource uri from the package name', function (): void {
$resource = new ThirdPartyResource('acme/payments', $this->testBladePath);
$resource = new PackageGuidelineResource('acme/payments', $this->testBladePath);

expect($resource->uri())->toBe('file://instructions/acme/payments.md');
});

test('it generates a description from the package name', function (): void {
$resource = new ThirdPartyResource('acme/payments', $this->testBladePath);
$resource = new PackageGuidelineResource('acme/payments', $this->testBladePath);

expect($resource->description())->toBe('Guidelines for acme/payments');
});

test('it has Markdown mime type', function (): void {
$resource = new ThirdPartyResource('acme/payments', $this->testBladePath);
$resource = new PackageGuidelineResource('acme/payments', $this->testBladePath);

expect($resource->mimeType())->toBe('text/markdown');
});

test('it renders blade guideline content', function (): void {
$resource = new ThirdPartyResource('acme/payments', $this->testBladePath);
$resource = new PackageGuidelineResource('acme/payments', $this->testBladePath);

$response = $resource->handle();

Expand All @@ -62,7 +62,7 @@

file_put_contents($this->testBladePath, $bladeContent);

$resource = new ThirdPartyResource('test/package', $this->testBladePath);
$resource = new PackageGuidelineResource('test/package', $this->testBladePath);
$response = $resource->handle();

expect($response)->isToolResult()
Expand All @@ -81,7 +81,7 @@

file_put_contents($this->testBladePath, $bladeContent);

$resource = new ThirdPartyResource('test/package', $this->testBladePath);
$resource = new PackageGuidelineResource('test/package', $this->testBladePath);
$response = $resource->handle();

expect($response)->isToolResult()
Expand All @@ -100,7 +100,7 @@ function example() {

file_put_contents($this->testBladePath, $bladeContent);

$resource = new ThirdPartyResource('test/package', $this->testBladePath);
$resource = new PackageGuidelineResource('test/package', $this->testBladePath);
$response = $resource->handle();

expect($response)->isToolResult()
Expand All @@ -119,7 +119,7 @@ function example() {

file_put_contents($this->testBladePath, $bladeContent);

$resource = new ThirdPartyResource('test/package', $this->testBladePath);
$resource = new PackageGuidelineResource('test/package', $this->testBladePath);

$response1 = $resource->handle();
$content1 = (string) $response1->content();
Expand All @@ -133,7 +133,7 @@ function example() {
});

test('it handles non-existent blade file gracefully', function (): void {
$resource = new ThirdPartyResource('acme/test', '/non/existent/path.blade.php');
$resource = new PackageGuidelineResource('acme/test', '/non/existent/path.blade.php');

$response = $resource->handle();

Expand Down