prompt_understanding
Analyze user queries related to Alibaba Cloud services and translate them into actionable expert recommendations. Essential for optimizing operations on ECS, VPC, RDS, OSS, CloudMonitor, and OOS.
Instructions
阿里云专家提示词理解 - 总是首先使用此工具来理解针对阿里云的用户查询并转换为阿里云专家建议
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- complete_fastmcp_server.py:402-416 (handler)Handler function for the 'prompt_understanding' tool. Decorated with @app.tool() which registers it as an MCP tool. Dynamically imports and calls the PromptUnderstanding helper to return the understanding prompt.@app.tool() def prompt_understanding() -> str: """阿里云专家提示词理解 - 总是首先使用此工具来理解针对阿里云的用户查询并转换为阿里云专家建议""" try: sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'alibaba_cloud_ops_mcp_server')) from tools import common_api_tools for tool_func in common_api_tools.tools: if hasattr(tool_func, '__name__') and 'prompt' in tool_func.__name__.lower(): result = tool_func() return str(result) return "阿里云专家提示词理解功能可用" except Exception as e: return f"提示词理解失败: {str(e)}"
- Helper function called by the main handler. Returns the PROMPT_UNDERSTANDING content, optionally customized with service list.@tools.append def PromptUnderstanding() -> str: """ Always use this tool first to understand the user's query and convert it into suggestions from Alibaba Cloud experts. """ global _CUSTOM_SERVICE_LIST content = PROMPT_UNDERSTANDING if _CUSTOM_SERVICE_LIST: import re pattern = r'Supported Services\s*:\s*\n(?:\s{3}- .+?\n)+' replacement = f"Supported Services:\n - " + "\n - ".join([f"{k}: {v}" for k, v in _CUSTOM_SERVICE_LIST]) content = re.sub(pattern, replacement, content, flags=re.DOTALL) return content
- Loads the static prompt content from PROMPT_UNDERSTANDING.md file into the PROMPT_UNDERSTANDING constant used by the helpers.from importlib import resources with ( resources.files('alibaba_cloud_ops_mcp_server.alibabacloud.static') .joinpath('PROMPT_UNDERSTANDING.md') .open('r', encoding='utf-8') as f ): PROMPT_UNDERSTANDING = f.read()