You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When crafting prompts that reference your tools or resources, consult the [official prompt guidelines](https://modelcontextprotocol.io/docs/concepts/prompts). Prompts are reusable templates that can accept arguments, include resource context and even describe multi-step workflows.
579
+
580
+
**Prompt structure**
581
+
582
+
```json
583
+
{
584
+
"name": "string",
585
+
"description": "string",
586
+
"arguments": [
587
+
{
588
+
"name": "string",
589
+
"description": "string",
590
+
"required": true
591
+
}
592
+
]
593
+
}
594
+
```
595
+
596
+
Clients discover prompts via `prompts/list` and request specific ones with `prompts/get`:
597
+
598
+
```json
599
+
{
600
+
"method": "prompts/get",
601
+
"params": {
602
+
"name": "analyze-code",
603
+
"arguments": {
604
+
"language": "php"
605
+
}
606
+
}
607
+
}
608
+
```
609
+
610
+
**Example Prompt Class**
611
+
612
+
```php
613
+
use OPGG\LaravelMcpServer\Services\PromptService\Prompt;
614
+
615
+
class WelcomePrompt extends Prompt
616
+
{
617
+
public string $name = 'welcome-user';
618
+
619
+
public ?string $description = 'A customizable welcome message for users';
620
+
621
+
public array $arguments = [
622
+
[
623
+
'name' => 'username',
624
+
'description' => 'The name of the user to welcome',
625
+
'required' => true,
626
+
],
627
+
[
628
+
'name' => 'role',
629
+
'description' => 'The role of the user (optional)',
630
+
'required' => false,
631
+
],
632
+
];
633
+
634
+
public string $text = 'Welcome, {username}! You are logged in as {role}.';
635
+
}
488
636
```
489
637
638
+
Prompts can embed resources and return sequences of messages to guide an LLM. See the official documentation for advanced examples and best practices.
639
+
640
+
490
641
### Testing MCP Tools
491
642
492
643
The package includes a special command for testing your MCP tools without needing a real MCP client:
0 commit comments