Skip to main content

查询工具列表

查询指定 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 服务无需提前开通。首次查询工具或调用工具时,服务可能自动完成开通。