prompt_understanding
Analyze user queries about Alibaba Cloud services and convert them into expert recommendations for ECS, VPC, RDS, OSS, CloudMonitor, and OOS operations.
Instructions
阿里云专家提示词理解 - 总是首先使用此工具来理解针对阿里云的用户查询并转换为阿里云专家建议
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- complete_fastmcp_server.py:403-416 (handler)Handler function for the 'prompt_understanding' tool. Registered via @app.tool() decorator. Delegates execution to the internal PromptUnderstanding tool from common_api_tools module.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)}"
- Core helper function that provides the prompt understanding content. Loads PROMPT_UNDERSTANDING and optionally customizes it with a service list before returning as a string.@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 the embedded PROMPT_UNDERSTANDING.md file into the PROMPT_UNDERSTANDING constant used by the tool.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()