[Server] Add meta to addPrompt and addResourceTemplate methods #149
+30
−19
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.