yeepay_yop_java_sdk_user_guide
Retrieve the YOP Java SDK user guide, including links to detailed descriptions for each component.
Instructions
通过此工具,获取易宝支付开放平台(YOP)的yop-java-sdk的使用说明,内容中包含链接时可以调用工具yeepay_yop_link_detail进一步获取其详细内容
Returns: str: 易宝支付开放平台(YOP)的yop-java-sdk的使用说明(markdown格式)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- yop_mcp/main.py:171-195 (handler)The tool handler function yeepay_yop_java_sdk_user_guide() that fetches the yop-java-sdk usage guide. It first retrieves platform version info from an API endpoint, then uses that version to construct the URL for the Java SDK guide HTML page. On failure, it falls back to a static markdown URL.
@mcp.tool() def yeepay_yop_java_sdk_user_guide() -> str: """ 通过此工具,获取易宝支付开放平台(YOP)的yop-java-sdk的使用说明,内容中包含链接时可以调用工具yeepay_yop_link_detail进一步获取其详细内容 Returns: str: 易宝支付开放平台(YOP)的yop-java-sdk的使用说明(markdown格式) """ try: platform_info = json.loads( HttpUtils.download_content( "https://open.yeepay.com/apis/commons/doc/platform/info" ) ) platform_version = platform_info.get("data").get("docVersion") return HttpUtils.download_content( "https://open.yeepay.com/apis/docs/platform/" + platform_version + "/sdk_guide/java-sdk-guide.html" ) except (ValueError, TypeError, ConnectionError): return HttpUtils.download_content( "https://open.yeepay.com/docs-v3/platform/201.md" ) - yop_mcp/main.py:171-172 (registration)The tool is registered via the @mcp.tool() decorator on line 171, which registers yeepay_yop_java_sdk_user_guide as an MCP tool with the FastMCP server instance.
@mcp.tool() def yeepay_yop_java_sdk_user_guide() -> str: - tools/http_utils.py:13-37 (helper)The HttpUtils.download_content() static method is the helper used by the handler to make HTTP requests and retrieve content from URLs.
@staticmethod def download_content(url: str, timeout: Optional[int] = None) -> str: """ 同步下载文件(无进度显示)并返回文件内容 Args: url: 下载地址 timeout: 超时时间(秒) Returns: str: 下载的文本内容 """ try: with httpx.Client(http2=True, timeout=timeout) as client: # 启用HTTP/2加速 response = client.get(url) response.raise_for_status() # 自动检测4xx/5xx错误 content = response.text print(f"已获取内容,长度: {len(content)} 字符") return content except httpx.HTTPStatusError as e: print(f"HTTP错误 {e.response.status_code}") return f"HTTP请求失败: HTTP {e.response.status_code}" except Exception as e: # 保持通用异常处理以支持测试 print(f"请求失败:{str(e)}") return f"HTTP请求失败: {str(e)}" - yop_mcp/main.py:173-178 (schema)The docstring serves as the schema/description for this tool. It describes that the tool retrieves the yop-java-sdk usage guide from the YOP platform and mentions that links can be followed with yeepay_yop_link_detail.
""" 通过此工具,获取易宝支付开放平台(YOP)的yop-java-sdk的使用说明,内容中包含链接时可以调用工具yeepay_yop_link_detail进一步获取其详细内容 Returns: str: 易宝支付开放平台(YOP)的yop-java-sdk的使用说明(markdown格式) - tests/test_main.py:14-25 (registration)The tool is imported in the test file on line 18, confirming it's exported from the yop_mcp.main module for use by the MCP framework and tests.
from yop_mcp.main import ( yeepay_yop_api_detail, yeepay_yop_download_cert, yeepay_yop_gen_key_pair, yeepay_yop_java_sdk_user_guide, yeepay_yop_link_detail, yeepay_yop_overview, yeepay_yop_parse_certificates, yeepay_yop_product_detail_and_associated_apis, yeepay_yop_product_overview, yeepay_yop_sdk_and_tools_guide, )