yeepay_yop_api_detail
Get complete API details from YOP for any URI, including parameters, examples, error codes, callbacks, and sample code.
Instructions
通过此工具,获取易宝支付开放平台(YOP)的API接口的详细定义,包含基本信息、请求参数、请求示例、 响应参数、响应示例、错误码、回调、示例代码等信息,内容中包含链接时可以调用工具yeepay_yop_link_detail进一步获取其详细内容
Args: api_uri: str - API的URI路径, 例如:/rest/v1.0/aggpay/pre-pay, https://open.yeepay.com/docs-v3/api/post_rest_v1.0_aggpay_pre-pay.md, https://open.yeepay.com/docs-v2/apis/user-scan/post__rest__v1.0__aggpay__pre-pay/index.html
Returns: str: 易宝支付开放平台(YOP)的API接口的详细定义,包含基本信息、请求参数、请求示例、 响应参数、响应示例、错误码、回调、示例代码等信息(markdown格式)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_uri | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- yop_mcp/main.py:65-129 (handler)The main handler for the 'yeepay_yop_api_detail' tool. It takes an API URI string, processes various URL formats (direct .md URLs, .html documentation pages, raw URIs), constructs appropriate API documentation URLs, downloads content via HttpUtils, and returns the markdown result.
@mcp.tool() def yeepay_yop_api_detail(api_uri: str) -> str: """ 通过此工具,获取易宝支付开放平台(YOP)的API接口的详细定义,包含基本信息、请求参数、请求示例、 响应参数、响应示例、错误码、回调、示例代码等信息,内容中包含链接时可以调用工具yeepay_yop_link_detail进一步获取其详细内容 Args: api_uri: str - API的URI路径, 例如:/rest/v1.0/aggpay/pre-pay, https://open.yeepay.com/docs-v3/api/post_rest_v1.0_aggpay_pre-pay.md, https://open.yeepay.com/docs-v2/apis/user-scan/post__rest__v1.0__aggpay__pre-pay/index.html Returns: str: 易宝支付开放平台(YOP)的API接口的详细定义,包含基本信息、请求参数、请求示例、 响应参数、响应示例、错误码、回调、示例代码等信息(markdown格式) """ api_uri = api_uri.strip() response = "HTTP请求失败" if api_uri.startswith("http"): if api_uri.endswith(".md"): response = HttpUtils.download_content(api_uri) elif ( api_uri.endswith(".html") or "/docs/apis/" in api_uri or "/docs-v2/apis/" in api_uri ): url_parts = api_uri.split("/") for part in url_parts: if ( part.startswith("post__") or part.startswith("get__") or part.startswith("options__") ): api_id = part.replace("__", "_") response = HttpUtils.download_content( "https://open.yeepay.com/docs-v3/api/" + api_id + ".md" ) break if response.startswith("HTTP请求失败") and "_" in api_uri: response = HttpUtils.download_content( "https://open.yeepay.com/docs-v3/api/" + api_uri + ".md" ) formatted_api_uri = api_uri.replace("/", "_") if response.startswith("HTTP请求失败"): response = HttpUtils.download_content( "https://open.yeepay.com/docs-v3/api/" + formatted_api_uri + ".md" ) if response.startswith("HTTP请求失败"): response = HttpUtils.download_content( "https://open.yeepay.com/docs-v3/api/post" + formatted_api_uri + ".md" ) if response.startswith("HTTP请求失败"): response = HttpUtils.download_content( "https://open.yeepay.com/docs-v3/api/get" + formatted_api_uri + ".md" ) if response.startswith("HTTP请求失败"): response = HttpUtils.download_content( "https://open.yeepay.com/docs-v3/api/options" + formatted_api_uri + ".md" ) return response - yop_mcp/main.py:65-65 (registration)The tool is registered via the @mcp.tool() decorator on the function definition, which is the MCP framework's standard registration mechanism.
@mcp.tool() - yop_mcp/main.py:66-79 (schema)The schema is defined through the function signature and docstring: input is a single string parameter 'api_uri' (the API URI path), output is a string (markdown format with API details). Type hints provide basic validation.
def yeepay_yop_api_detail(api_uri: str) -> str: """ 通过此工具,获取易宝支付开放平台(YOP)的API接口的详细定义,包含基本信息、请求参数、请求示例、 响应参数、响应示例、错误码、回调、示例代码等信息,内容中包含链接时可以调用工具yeepay_yop_link_detail进一步获取其详细内容 Args: api_uri: str - API的URI路径, 例如:/rest/v1.0/aggpay/pre-pay, https://open.yeepay.com/docs-v3/api/post_rest_v1.0_aggpay_pre-pay.md, https://open.yeepay.com/docs-v2/apis/user-scan/post__rest__v1.0__aggpay__pre-pay/index.html Returns: str: 易宝支付开放平台(YOP)的API接口的详细定义,包含基本信息、请求参数、请求示例、 响应参数、响应示例、错误码、回调、示例代码等信息(markdown格式)