python-sdk
python-sdk copied to clipboard
Move `Prompt` object instantiation from server to prompt manager
The Prompt() decorator in server.py is instantiating a Prompt object before adding it to the list of prompts. This is inconsistent with how the Tool() decorator works; it delegates tool instantiation to the tool manager.
Motivation and Context
To make the decorators consistent and create clear separation of concerns: I have moved prompt object instantiation from server.py to prompts/manager.py.
How Has This Been Tested?
I updated and ran all unit tests.
Breaking Changes
No. Users will not be impacted as the prompt() decorator's signature remains unchanged.
Types of changes
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation update
Checklist
- [X] I have read the MCP Documentation
- [X] My code follows the repository's style guidelines
- [X] New and existing tests pass locally
- [X] I have added appropriate error handling
- [ ] I have added or updated documentation as needed
Additional context
Separation of concerns: instantiation and managements of prompt objects should be done by the prompt manager, not the server.