122 lines
8.8 KiB
Markdown
122 lines
8.8 KiB
Markdown
```
|
||
# ========== 1. 请求数统计 ==========
|
||
curl -X POST http://localhost:7530/api/mcp-tools \
|
||
-H "Content-Type: application/json" \
|
||
-d '{
|
||
"name": "get_request_count",
|
||
"description": "查询请求数统计数据,返回各时间点的请求数列表",
|
||
"backendUrl": "http://dev.p.cdn.10086.cn:8080/mcp/requestCount",
|
||
"backendMethod": "GET",
|
||
"backendTimeout": 10000,
|
||
"forwardHeaders": ["Authorization", "X-User-Id"],
|
||
"responseDescription": "返回 JSON,errCode=0 为成功,data 为数据列表,示例:{\"errCode\":0,\"data\":[{\"name\":\"2026-03-27 10:00\",\"value\":12345}],\"unit\":\"\"}",
|
||
"parameters": [
|
||
{"name": "cpId", "type": "string", "description": "企业ID(空默认全部)", "required": false, "sortOrder": 0},
|
||
{"name": "domainNames", "type": "string", "description": "域名列表,逗号分隔(空默认全部)", "required": false, "sortOrder": 1},
|
||
{"name": "product", "type": "string", "description": "产品类型(空默认全部,下载加速:0,视音频点播加速:1,网页加速:2,直播加速:5,超低时延直播:7,全站四层加速:8,全站七层加速:9)", "required": false, "sortOrder": 2},
|
||
{"name": "granular", "type": "string", "description": "时间粒度(5分钟:0,1小时:1,1天:2)", "required": false, "sortOrder": 3},
|
||
{"name": "providers", "type": "string", "description": "加速厂商列表,逗号分隔(空默认全部,华为平面:1,中兴平面:2,HCDN:3,自研1.0:4,自研RTMP:5,自研2.0:8,国际平面:9,合作服务商1:10,合作服务商2:11)", "required": false, "sortOrder": 4},
|
||
{"name": "affectAreas", "type": "string", "description": "加速区域列表,逗号分隔(空默认全部,例如安徽、北京、福建)", "required": false, "sortOrder": 5},
|
||
{"name": "isps", "type": "string", "description": "运营商列表,逗号分隔(空默认全部,移动:1,电信:2,联通:3,多线:4,国际:5,其他:0)", "required": false, "sortOrder": 6},
|
||
{"name": "startTime", "type": "string", "description": "开始时间,格式 yyyy-MM-dd HH:mm", "required": false, "sortOrder": 7},
|
||
{"name": "endTime", "type": "string", "description": "结束时间,格式 yyyy-MM-dd HH:mm", "required": false, "sortOrder": 8}
|
||
]
|
||
}'
|
||
|
||
# ========== 2. 命中请求数统计 ==========
|
||
curl -X POST http://localhost:7530/api/mcp-tools \
|
||
-H "Content-Type: application/json" \
|
||
-d '{
|
||
"name": "get_hit_req_count",
|
||
"description": "查询命中请求数统计数据,返回各时间点的命中请求数列表",
|
||
"backendUrl": "http://dev.p.cdn.10086.cn:8080/mcp/hitReqCount",
|
||
"backendMethod": "GET",
|
||
"backendTimeout": 10000,
|
||
"forwardHeaders": ["Authorization", "X-User-Id"],
|
||
"responseDescription": "返回 JSON,errCode=0 为成功,data 为数据列表,示例:{\"errCode\":0,\"data\":[{\"name\":\"2026-03-27 10:00\",\"value\":10000}],\"unit\":\"\"}",
|
||
"parameters": [
|
||
{"name": "cpId", "type": "string", "description": "企业ID(空默认全部)", "required": false, "sortOrder": 0},
|
||
{"name": "domainNames", "type": "string", "description": "域名列表,逗号分隔(空默认全部)", "required": false, "sortOrder": 1},
|
||
{"name": "product", "type": "string", "description": "产品类型(空默认全部)", "required": false, "sortOrder": 2},
|
||
{"name": "granular", "type": "string", "description": "时间粒度(5分钟:0,1小时:1,1天:2)", "required": false, "sortOrder": 3},
|
||
{"name": "providers", "type": "string", "description": "加速厂商列表,逗号分隔(空默认全部)", "required": false, "sortOrder": 4},
|
||
{"name": "affectAreas", "type": "string", "description": "加速区域列表,逗号分隔(空默认全部)", "required": false, "sortOrder": 5},
|
||
{"name": "isps", "type": "string", "description": "运营商列表,逗号分隔(空默认全部)", "required": false, "sortOrder": 6},
|
||
{"name": "startTime", "type": "string", "description": "开始时间,格式 yyyy-MM-dd HH:mm", "required": false, "sortOrder": 7},
|
||
{"name": "endTime", "type": "string", "description": "结束时间,格式 yyyy-MM-dd HH:mm", "required": false, "sortOrder": 8}
|
||
]
|
||
}'
|
||
|
||
# ========== 3. 命中率计算(一次性接口) ==========
|
||
curl -X POST http://localhost:7530/api/mcp-tools \
|
||
-H "Content-Type: application/json" \
|
||
-d '{
|
||
"name": "get_hit_ratio",
|
||
"description": "计算命中率,命中率 = 命中请求数 / 总请求数,返回各时间点的命中率百分比(2位小数)",
|
||
"backendUrl": "http://dev.p.cdn.10086.cn:8080/mcp/hitRatio",
|
||
"backendMethod": "GET",
|
||
"backendTimeout": 10000,
|
||
"forwardHeaders": ["Authorization", "X-User-Id"],
|
||
"responseDescription": "返回 JSON,errCode=0 为成功,data 为数据列表,unit 为 %,示例:{\"errCode\":0,\"data\":[{\"name\":\"2026-03-27 10:00\",\"value\":85.23}],\"unit\":\"%\"}",
|
||
"parameters": [
|
||
{"name": "cpId", "type": "string", "description": "企业ID(空默认全部)", "required": false, "sortOrder": 0},
|
||
{"name": "domainNames", "type": "string", "description": "域名列表,逗号分隔(空默认全部)", "required": false, "sortOrder": 1},
|
||
{"name": "product", "type": "string", "description": "产品类型(空默认全部)", "required": false, "sortOrder": 2},
|
||
{"name": "granular", "type": "string", "description": "时间粒度(5分钟:0,1小时:1,1天:2)", "required": false, "sortOrder": 3},
|
||
{"name": "providers", "type": "string", "description": "加速厂商列表,逗号分隔(空默认全部)", "required": false, "sortOrder": 4},
|
||
{"name": "affectAreas", "type": "string", "description": "加速区域列表,逗号分隔(空默认全部)", "required": false, "sortOrder": 5},
|
||
{"name": "isps", "type": "string", "description": "运营商列表,逗号分隔(空默认全部)", "required": false, "sortOrder": 6},
|
||
{"name": "startTime", "type": "string", "description": "开始时间,格式 yyyy-MM-dd HH:mm", "required": false, "sortOrder": 7},
|
||
{"name": "endTime", "type": "string", "description": "结束时间,格式 yyyy-MM-dd HH:mm", "required": false, "sortOrder": 8}
|
||
]
|
||
}'
|
||
|
||
# ========== 4. 命中率工具(分步计算用:先调requestCount,再调hitReqCount,最后调此工具计算) ==========
|
||
curl -X POST http://localhost:7530/api/mcp-tools \
|
||
-H "Content-Type: application/json" \
|
||
-d '{
|
||
"name": "calculate_hit_ratio",
|
||
"description": "根据请求数和命中请求数计算命中率,返回百分比(2位小数)。适用于先调用 get_request_count 和 get_hit_req_count 获取原始数据后,再调用此工具计算命中率",
|
||
"backendUrl": "http://dev.p.cdn.10086.cn:8080/mcp/hitRatio/calculate",
|
||
"backendMethod": "GET",
|
||
"backendTimeout": 5000,
|
||
"forwardHeaders": ["Authorization", "X-User-Id"],
|
||
"responseDescription": "返回 JSON,errCode=0 为成功,示例:{\"errCode\":0,\"data\":[{\"name\":\"hitRatio\",\"value\":85.23}],\"unit\":\"%\"}",
|
||
"parameters": [
|
||
{"name": "requestCount", "type": "integer", "description": "总请求数", "required": true, "sortOrder": 0},
|
||
{"name": "hitReqCount", "type": "integer", "description": "命中请求数", "required": true, "sortOrder": 1}
|
||
]
|
||
}'
|
||
|
||
# ========== 5. 获取企业列表 ==========
|
||
curl -X POST http://localhost:7530/api/mcp-tools \
|
||
-H "Content-Type: application/json" \
|
||
-d '{
|
||
"name": "get_enterprise_list",
|
||
"description": "获取当前用户所属的企业列表,返回 enterpriseId 和 enterpriseName,供统计接口选择企业参数用",
|
||
"backendUrl": "http://dev.p.cdn.10086.cn:8080/mcp/enterprises",
|
||
"backendMethod": "GET",
|
||
"backendTimeout": 5000,
|
||
"forwardHeaders": ["Authorization", "X-User-Id"],
|
||
"responseDescription": "返回 JSON 列表,每个元素含 enterpriseId 和 enterpriseName,示例:[{\"enterpriseId\":\"abc123\",\"enterpriseName\":\"测试企业\"}]",
|
||
"parameters": []
|
||
}'
|
||
|
||
# ========== 6. 获取域名列表 ==========
|
||
curl -X POST http://localhost:7530/api/mcp-tools \
|
||
-H "Content-Type: application/json" \
|
||
-d '{
|
||
"name": "get_domain_list",
|
||
"description": "根据企业ID获取该企业下已生效的域名列表,供统计接口选择域名参数用",
|
||
"backendUrl": "http://dev.p.cdn.10086.cn:8080/mcp/domains",
|
||
"backendMethod": "GET",
|
||
"backendTimeout": 5000,
|
||
"forwardHeaders": ["Authorization", "X-User-Id"],
|
||
"responseDescription": "返回 JSON 列表,每个元素为域名字符串,示例:[\"www.example.com\",\"img.example.com\"]",
|
||
"parameters": [
|
||
{"name": "tenantId", "type": "string", "description": "企业ID(tenantId,即 enterpriseId)", "required": true, "sortOrder": 0}
|
||
]
|
||
}'
|
||
|
||
```
|