查询指定 MCP 服务提供的工具名称、描述和入参 schema。
接口
GET
/api/v1/mcp/servers/{mcpCode}/tools返回指定 MCP 服务当前可用的工具列表。
路径参数
mcpCodestring必填MCP 编码
响应字段
data 为工具数组,每个工具包含以下字段:
namestring / null工具名称
descriptionstring / null工具描述
inputSchemaobject / null工具入参 schema
inputSchema.typestring / null通常为 object
inputSchema.propertiesmap<string,object> / null参数定义
inputSchema.requiredarray<string> / null必填参数名
inputSchema.additionalPropertiesboolean / null是否允许额外参数
请求示例
curl "https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/mcp/servers/mcp-a1b2c3d4e5f6g7h8/tools" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY"
响应示例
{
"success": true,
"error_code": null,
"error_msg": null,
"data": [
{
"name": "get_weather",
"description": "查询指定城市的天气",
"inputSchema": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "城市名称"
}
},
"required": ["city"],
"additionalProperties": false
}
}
],
"request_id": "6f1c2a8e-3b0d-4c55-9a0e-2f7d1c9b8a11"
}
错误码
| HTTP 状态码 | error_code | 说明 |
|---|---|---|
| 400 | - | 服务未开通、实例异常或工具列表为空,错误码由 MCP 服务返回 |
| 500 | InternalError | 服务内部错误 |
说明One Key MCP 服务无需提前开通。首次查询工具或调用工具时,服务可能自动完成开通。
该文章对您有帮助吗?