-
Notifications
You must be signed in to change notification settings - Fork 45
Add resource template support #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
alejojperez
wants to merge
19
commits into
laravel:main
from
alejojperez:add-resource-template-support
Closed
Add resource template support #82
alejojperez
wants to merge
19
commits into
laravel:main
from
alejojperez:add-resource-template-support
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Added ability to set the actual uri that was received
…ethod since path variables are only available if the resource is a template
…ethod since path variables are only available if the resource is a template
PR number 80 has a better implementation. I'm closing this PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 Add Resource Template Support
Summary
This PR introduces comprehensive support for resource templates in the MCP server, enabling dynamic URI matching and path parameter extraction. The implementation includes a new
ListResourceTemplates
method, enhanced URI matching capabilities, and extensive testing coverage.🎯 Key Features Added
New Resource Template Functionality
ListResourceTemplates
Method: New server method to retrieve available resource templates/users/{id}
)Enhanced Resource Management
Testing Infrastructure Improvements
📁 Files Changed
15 files changed, 790 insertions(+), 18 deletions(-)
Core Implementation
src/Server.php
- Added ListResourceTemplates method registrationsrc/Server/Methods/ListResourceTemplates.php
- NEW: Main implementation of resource template listingsrc/Server/Methods/ReadResource.php
- Enhanced to handle path parameter populationsrc/Server/Resource.php
- Major enhancements for template matching and URI handlingsrc/Server/ServerContext.php
- Added support for path variable managementURI Matching System
src/Server/Resources/Uri.php
- NEW: Comprehensive URI handling and template matching (283+ lines)src/Server/Resources/Matching/ValidatorInterface.php
- NEW: Base interface for URI validatorssrc/Server/Resources/Matching/SchemeValidator.php
- NEW: Scheme validation implementationsrc/Server/Resources/Matching/UriValidator.php
- NEW: URI pattern validation implementationTesting Enhancements
src/Server/Testing/PendingTestResponse.php
- Added parameter override functionalitysrc/Server/Testing/TestResponse.php
- Enhanced with URI testing supporttests/TestCase.php
- Refactored for better test utilitiestests/Unit/Resources/ListResourceTemplatesTest.php
- NEW: Comprehensive unit tests (143+ lines)tests/Unit/Resources/ReadResourceTest.php
- NEW: Read resource testingtests/Feature/Testing/Resources/AssertSeeTest.php
- NEW: Feature tests for resource assertions🔧 Technical Details
/api/users/{userId}/posts/{postId}
✅ Testing
This enhancement significantly expands the MCP server's capabilities for handling dynamic resources while maintaining full backward compatibility with existing implementations.