查询工具列表

更新时间:
复制 MD 格式

查询指定 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 服务返回
500InternalError服务内部错误

说明One Key MCP 服务无需提前开通。首次查询工具或调用工具时,服务可能自动完成开通。