[Server] Add meta to addPrompt and addResourceTemplate methods#149
Merged
Merged
Conversation
3cafd18 to
27fd2f7
Compare
461c0b5 to
cd1fe73
Compare
…ce nullable properties
cd1fe73 to
5918e6c
Compare
Member
|
that setup just doesn't feel that robust, but that's not on you - your basically just cleaning up - thanks for that! |
Contributor
Author
|
@chr-hertel There was also an issue because meta was not null-coalesced also when using addPrompt it was not added to the prompt array, which then caused that undefined key error. |
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
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.
Summary
Add missing
metaparameter toBuilder::addResourceTemplate()andBuilder::addPrompt()methods to complete the metadata support across all registration methods.Motivation and Context
The
ResourceTemplateandPromptschemas support a_metafield for passing additional metadata. However, theBuilder::addResourceTemplate()andBuilder::addPrompt()methods didn't expose this parameter, creating an inconsistency with other registration methods likeaddTool()andaddResource()which already supportmeta.This change completes the metadata support across all manual registration methods, providing a consistent API for users to attach arbitrary metadata to any MCP element.
How Has This Been Tested?
metaparameter is properly added to both methodscompact()calls include the newmetaparameteraddTool()andaddResource()implementationsBreaking Changes
None. This is a backward-compatible change:
metaparameter is optional with a default value ofnullmetafield is only included when explicitly providedTypes of changes
Checklist
Additional context
Changes made:
metaparameter toBuilder::addResourceTemplate()methodmetaparameter toBuilder::addPrompt()methodcompact()calls to includemetain both methodsThis completes the metadata support that was previously added to
addTool()andaddResource()in PR #144, ensuring all manual registration methods have feature parity with the underlying schema classes.Note: The corresponding PHPDoc type definitions and ArrayLoader changes will need to be updated separately to fully support these fields throughout the registration pipeline.