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
Copy file name to clipboardExpand all lines: README.md
+44-42Lines changed: 44 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,50 @@ The `OPGG\LaravelMcpServer\Services\ToolService\ToolInterface` has been updated
47
47
48
48
**How to Update Your Tools:**
49
49
50
-
Here's a comparison to help you adapt your existing tools:
50
+
### Automated Tool Migration for v1.1.0
51
+
52
+
To assist with the transition to the new `ToolInterface` introduced in v1.1.0, we've included an Artisan command that can help automate the refactoring of your existing tools:
53
+
54
+
```bash
55
+
php artisan mcp:migrate-tools {path?}
56
+
```
57
+
58
+
**What it does:**
59
+
60
+
This command will scan PHP files in the specified directory (defaults to `app/MCP/Tools/`) and attempt to:
61
+
62
+
1.**Identify old tools:** It looks for classes implementing the `ToolInterface` with the old method signatures.
63
+
2.**Create Backups:** Before making any changes, it will create a backup of your original tool file with a `.backup` extension (e.g., `YourTool.php.backup`). If a backup file already exists, the original file will be skipped to prevent accidental data loss.
64
+
3.**Refactor the Tool:**
65
+
- Rename methods:
66
+
-`getName()` to `name()`
67
+
-`getDescription()` to `description()`
68
+
-`getInputSchema()` to `inputSchema()`
69
+
-`getAnnotations()` to `annotations()`
70
+
- Add the new `messageType()` method, which will default to returning `ProcessMessageType::SSE`.
71
+
- Ensure the `use OPGG\LaravelMcpServer\Enums\ProcessMessageType;` statement is present.
72
+
73
+
**Usage:**
74
+
75
+
After updating the `opgginc/laravel-mcp-server` package to v1.1.0 or later, if you have existing tools written for v1.0.x, it is highly recommended to run this command:
76
+
77
+
```bash
78
+
php artisan mcp:migrate-tools
79
+
```
80
+
81
+
If your tools are located in a directory other than `app/MCP/Tools/`, you can specify the path:
82
+
83
+
```bash
84
+
php artisan mcp:migrate-tools path/to/your/tools
85
+
```
86
+
87
+
The command will output its progress, indicating which files are being processed, backed up, and migrated. Always review the changes made by the tool. While it aims to be accurate, complex or unusually formatted tool files might require manual adjustments.
88
+
89
+
This tool should significantly ease the migration process and help you adapt to the new interface structure quickly.
90
+
91
+
### Manual Migration
92
+
93
+
If you prefer to migrate your tools manually, here's a comparison to help you adapt your existing tools:
51
94
52
95
**v1.0.x `ToolInterface`:**
53
96
@@ -126,47 +169,6 @@ class MyNewTool implements ToolInterface
126
169
}
127
170
```
128
171
129
-
### Automated Tool Migration for v1.1.0
130
-
131
-
To assist with the transition to the new `ToolInterface` introduced in v1.1.0, we've included an Artisan command that can help automate the refactoring of your existing tools:
132
-
133
-
```bash
134
-
php artisan mcp:migrate-tools {path?}
135
-
```
136
-
137
-
**What it does:**
138
-
139
-
This command will scan PHP files in the specified directory (defaults to `app/MCP/Tools/`) and attempt to:
140
-
141
-
1.**Identify old tools:** It looks for classes implementing the `ToolInterface` with the old method signatures.
142
-
2.**Create Backups:** Before making any changes, it will create a backup of your original tool file with a `.backup` extension (e.g., `YourTool.php.backup`). If a backup file already exists, the original file will be skipped to prevent accidental data loss.
143
-
3.**Refactor the Tool:**
144
-
- Rename methods:
145
-
-`getName()` to `name()`
146
-
-`getDescription()` to `description()`
147
-
-`getInputSchema()` to `inputSchema()`
148
-
-`getAnnotations()` to `annotations()`
149
-
- Add the new `messageType()` method, which will default to returning `ProcessMessageType::SSE`.
150
-
- Ensure the `use OPGG\LaravelMcpServer\Enums\ProcessMessageType;` statement is present.
151
-
152
-
**Usage:**
153
-
154
-
After updating the `opgginc/laravel-mcp-server` package to v1.1.0 or later, if you have existing tools written for v1.0.x, it is highly recommended to run this command:
155
-
156
-
```bash
157
-
php artisan mcp:migrate-tools
158
-
```
159
-
160
-
If your tools are located in a directory other than `app/MCP/Tools/`, you can specify the path:
161
-
162
-
```bash
163
-
php artisan mcp:migrate-tools path/to/your/tools
164
-
```
165
-
166
-
The command will output its progress, indicating which files are being processed, backed up, and migrated. Always review the changes made by the tool. While it aims to be accurate, complex or unusually formatted tool files might require manual adjustments.
167
-
168
-
This tool should significantly ease the migration process and help you adapt to the new interface structure quickly.
169
-
170
172
## Overview of Laravel MCP Server
171
173
172
174
Laravel MCP Server is a powerful package designed to streamline the implementation of Model Context Protocol (MCP) servers in Laravel applications. **Unlike most Laravel MCP packages that use Standard Input/Output (stdio) transport**, this package focuses on **Streamable HTTP** transport and still includes a **legacy SSE provider** for backwards compatibility, providing a secure and controlled integration method.
0 commit comments