refactor: update prompt templates to follow standard MCP workflow

- Implement standard MCP prompt workflow with template variables
- Use {{parameter_name}} placeholders instead of direct string interpolation
- Add proper parameter replacement in server prompt registrations
- Update templates to return template strings with placeholders
- Follow MCP workflow: load template → parameter replacement → return final prompt
- Update documentation to reflect standard MCP workflow implementation
- Remove TEMPLATES_USE environment variable as requested
- Maintain all existing functionality while improving MCP compliance

Signed-off-by: longhao <hal.long@outlook.com>
This commit is contained in:
longhao 2025-05-29 16:09:31 +08:00 committed by Hal
parent de54e1e0e8
commit 4bdf38d455
4 changed files with 279 additions and 51 deletions

View file

@ -6,6 +6,20 @@ This document describes the MCP prompt templates available in the PyPI Query MCP
Prompt templates are reusable message templates that help you get structured guidance from LLMs for specific PyPI package management tasks. They provide comprehensive frameworks for analysis and decision-making.
### 🔄 MCP Workflow Implementation
Our prompt templates follow the standard MCP (Model Context Protocol) workflow:
1. **User calls tool** → MCP client sends request
2. **Tool function executes** → Collects necessary data and parameters
3. **Call Prompt generator** → Pass parameters to corresponding generator
4. **Load template** → Get template with `{{parameter}}` placeholders
5. **Parameter replacement** → Replace `{{parameter_name}}` with actual values
6. **Environment variable customization** → Apply user's custom prompt words (optional)
7. **Return final prompt** → As tool's response back to AI
This ensures consistent, reliable prompt generation that integrates seamlessly with MCP clients.
## 📋 Available Prompt Templates
### Package Analysis Templates