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
Enhance MCP tool interface and improve documentation for v1.3.0 (#31)
* docs(stubs): enhance documentation and examples for MCP stubs
* Refactor ToolInterface communication patterns for v1.3.0
- Remove ProcessMessageType::PROTOCOL enum (consolidated into HTTP)
- Replace confusing messageType() with intuitive isStreaming() boolean
- Enhance migration command to support v1.0.x, v1.1.x, v1.2.x → v1.3.0
- Update example tools to use new isStreaming() pattern
- Improve documentation with comprehensive v1.3.0 guidance
- Add deprecated features section for v2.0.0 planning
* Remove unnecessary documentation
* fix: make isStreaming() method optional for backward compatibility
- Remove isStreaming() requirement from ToolInterface to prevent fatal errors
- Existing tools without isStreaming() method now work without modification
- ToolsCallHandler already has fallback logic using method_exists()
- Update stub documentation to clarify isStreaming() is optional
- Maintain full backward compatibility for v1.1.x and v1.2.x tools
Fixes upgrade issues where users got fatal error:
"Class contains 1 abstract method and must implement isStreaming()"
* Fix styling
---------
Co-authored-by: kargnas <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+88-10Lines changed: 88 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,22 @@
26
26
<ahref="README.es.md">Español</a>
27
27
</p>
28
28
29
-
## ⚠️ Breaking Changes in v1.1.0
29
+
## ⚠️ Version Information & Breaking Changes
30
+
31
+
### v1.3.0 Changes (Current)
32
+
33
+
Version 1.3.0 introduces improvements to the `ToolInterface` for better communication control:
34
+
35
+
**New Features:**
36
+
- Added `isStreaming(): bool` method for clearer communication pattern selection
37
+
- Improved migration tools supporting upgrades from v1.1.x, v1.2.x to v1.3.0
38
+
- Enhanced stub files with comprehensive v1.3.0 documentation
39
+
40
+
**Deprecated Features:**
41
+
-`messageType(): ProcessMessageType` method is now deprecated (will be removed in v2.0.0)
42
+
- Use `isStreaming(): bool` instead for better clarity and simplicity
43
+
44
+
### Breaking Changes in v1.1.0
30
45
31
46
Version 1.1.0 introduced a significant and breaking change to the `ToolInterface`. If you are upgrading from v1.0.x, you **must** update your tool implementations to conform to the new interface.
32
47
@@ -154,17 +169,23 @@ use OPGG\LaravelMcpServer\Enums\ProcessMessageType; // Import the enum
154
169
155
170
class MyNewTool implements ToolInterface
156
171
{
157
-
// Add the new messageType() method
172
+
/**
173
+
* @deprecated since v1.3.0, use isStreaming() instead. Will be removed in v2.0.0
174
+
*/
158
175
public function messageType(): ProcessMessageType
159
176
{
160
-
// Return the appropriate message type, e.g., for a standard tool
161
-
return ProcessMessageType::SSE;
177
+
return ProcessMessageType::HTTP;
178
+
}
179
+
180
+
public function isStreaming(): bool
181
+
{
182
+
return false; // Most tools should return false
162
183
}
163
184
164
-
public function name(): string { return 'MyNewTool'; } // Renamed
165
-
public function description(): string { return 'This is my new tool.'; } // Renamed
166
-
public function inputSchema(): array { return []; } // Renamed
167
-
public function annotations(): array { return []; } // Renamed
185
+
public function name(): string { return 'MyNewTool'; }
186
+
public function description(): string { return 'This is my new tool.'; }
187
+
public function inputSchema(): array { return []; }
188
+
public function annotations(): array { return []; }
168
189
public function execute(array $arguments): mixed { /* ... */ }
169
190
}
170
191
```
@@ -309,9 +330,14 @@ use OPGG\LaravelMcpServer\Enums\ProcessMessageType;
309
330
310
331
interface ToolInterface
311
332
{
312
-
// Determines how the tool's messages are processed, often related to the transport.
333
+
/**
334
+
* @deprecated since v1.3.0, use isStreaming() instead. Will be removed in v2.0.0
335
+
*/
313
336
public function messageType(): ProcessMessageType;
314
337
338
+
// NEW in v1.3.0: Determines if this tool requires streaming (SSE) instead of standard HTTP.
339
+
public function isStreaming(): bool;
340
+
315
341
// The unique, callable name of your tool (e.g., 'get-user-details').
316
342
public function name(): string;
317
343
@@ -331,7 +357,9 @@ interface ToolInterface
331
357
332
358
Let's dive deeper into some of these methods:
333
359
334
-
**`messageType(): ProcessMessageType`**
360
+
**`messageType(): ProcessMessageType` (Deprecated in v1.3.0)**
361
+
362
+
⚠️ **This method is deprecated since v1.3.0.** Use `isStreaming(): bool` instead for better clarity.
335
363
336
364
This method specifies the type of message processing for your tool. It returns a `ProcessMessageType` enum value. The available types are:
337
365
@@ -340,6 +368,18 @@ This method specifies the type of message processing for your tool. It returns a
340
368
341
369
For most tools, especially those designed for the primary `streamable_http` provider, you'll return `ProcessMessageType::HTTP`.
342
370
371
+
**`isStreaming(): bool` (New in v1.3.0)**
372
+
373
+
This is the new, more intuitive method for controlling communication patterns:
374
+
375
+
-`return false`: Use standard HTTP request/response (recommended for most tools)
376
+
-`return true`: Use Server-Sent Events for real-time streaming
377
+
378
+
Most tools should return `false` unless you specifically need real-time streaming capabilities like:
379
+
- Real-time progress updates for long-running operations
380
+
- Live data feeds or monitoring tools
381
+
- Interactive tools requiring bidirectional communication
382
+
343
383
**`name(): string`**
344
384
345
385
This is the identifier for your tool. It should be unique. Clients will use this name to request your tool. For example: `get-weather`, `calculate-sum`.
@@ -752,6 +792,44 @@ You can also translate specific languages:
752
792
python scripts/translate_readme.py es ko
753
793
```
754
794
795
+
## Deprecated Features for v2.0.0
796
+
797
+
The following features are deprecated and will be removed in v2.0.0. Please update your code accordingly:
798
+
799
+
### ToolInterface Changes
800
+
801
+
**Deprecated since v1.3.0:**
802
+
- `messageType(): ProcessMessageType` method
803
+
- **Replacement:** Use `isStreaming(): bool` instead
804
+
- **Migration Guide:** Return `false` for HTTP tools, `true` for streaming tools
805
+
- **Automatic Migration:** Run `php artisan mcp:migrate-tools` to update your tools
806
+
807
+
**Example Migration:**
808
+
809
+
```php
810
+
// Old approach (deprecated)
811
+
public function messageType(): ProcessMessageType
812
+
{
813
+
return ProcessMessageType::HTTP;
814
+
}
815
+
816
+
// New approach (v1.3.0+)
817
+
public function isStreaming(): bool
818
+
{
819
+
return false; // Use false for HTTP, true for streaming
820
+
}
821
+
```
822
+
823
+
### Removed Features
824
+
825
+
**Removed in v1.3.0:**
826
+
- `ProcessMessageType::PROTOCOL` enum case (consolidated into `ProcessMessageType::HTTP`)
827
+
828
+
**Planning for v2.0.0:**
829
+
- Complete removal of `messageType()` method from `ToolInterface`
830
+
- All tools will be required to implement `isStreaming()` method only
831
+
- Simplified tool configuration and reduced complexity
832
+
755
833
## License
756
834
757
835
This project is distributed under the MIT license.
0 commit comments