-
Notifications
You must be signed in to change notification settings - Fork 45
[Add] Resource Template Implementation #80
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
base: main
Are you sure you want to change the base?
Conversation
…and ListResourceTemplates method handler
…egration for resource templates
…eCommand and publish resource-template stub in service provider
…ng resource templates with stub file
…emplates method and ResourceTemplate class
…ntextTest to support resource templates
…for CallTool, GetPrompt, and Initialize
…for ListPrompts, ListResources, and ListTools
…llTool, GetPrompt, and Initialize
…stPrompts, ListResources, and ListTools
… with RFC 6570 support and comprehensive tests
…t for variable injection
…ing with URI pattern matching and variable extraction in ReadResource
… implementations to support Resource|ResourceTemplate type union
…template-based resource reading with variable injection
Thanks for submitting a PR! Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
…P 8.1/8.4 compatibility and PHPStan compliance
…sourceTemplateCommand and pagination test for ListResourceTemplates
@keshav-k3 Hey, thank you for your contribution. I'm testing the code in your branch, and there is a small bug at Container::getInstance()->afterResolving(Request::class, function (Request $mcpRequest) use ($variables): void {
foreach ($variables as $key => $value) {
$mcpRequest->merge([$key => $value]);
}
}); CC: @taylorotwell |
…f bind to prevent variable loss from McpServiceProvider callback
@alejojperez Hey, appreciate the spot! I’ve fixed it and tested the change — LGTM! |
@keshav-k3 Hey, remember to mark your PR as ready for review! 😊 |
Issue
Description
Resource Templates Implementation
Adds support for Resource Templates in the MCP server, enabling dynamic resources with URI patterns.
Changes
ResourceTemplate
class extendingPrimitive
withuriTemplate
andmimeType
supportUriTemplateMatcher
utility for RFC 6570 URI template matching and variable extractionReadResource
enhanced to match URI patterns and inject extracted variables into template handlersListResourceTemplates
forresources/templates/list
endpointmake:mcp-resource-template
artisan command with stub fileServer
andServerContext
to support resource templatesUsage
php artisan make:mcp-resource-template UserProfile
Generates a resource template with dynamic URI patterns like
file://resources/user-profile/{id}