-
Notifications
You must be signed in to change notification settings - Fork 61
[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
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! 😊 |
|
Thanks for your pull request to Laravel! Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include. If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions! |
|
@nunomaduro @taylorotwell Hey Taylor, I think that you should reconsider your decision here. This PR is very much needed to add resource template capabilities to the MCP package. Unless you have already planned internally to add resource template support, I would appreciate it if you could reconsider your decision here. |
|
Hi, why is this PR closed if it is only delayed ? This feature will be more and more asked. |
Issue
Description
Resource Templates Implementation
Adds support for Resource Templates in the MCP server, enabling dynamic resources with URI patterns.
Changes
ResourceTemplateclass extendingPrimitivewithuriTemplateandmimeTypesupportUriTemplateMatcherutility for RFC 6570 URI template matching and variable extractionReadResourceenhanced to match URI patterns and inject extracted variables into template handlersListResourceTemplatesforresources/templates/listendpointmake:mcp-resource-templateartisan command with stub fileServerandServerContextto support resource templatesUsage
php artisan make:mcp-resource-template UserProfileGenerates a resource template with dynamic URI patterns like
file://resources/user-profile/{id}