Recommend tools

Updated at:

Recommends MCP tools based on a natural-language request and returns tool names, descriptions, and input schemas.

Endpoint

GET/api/v1/mcp/servers/tools/recommend

Query parameters

querystringRequired

Natural-language request. Cannot be blank

topNintOptional

Suggested number of results. Values less than or equal to 0 use the default 10

Default: 10

topN is a target count. The actual number of results is not guaranteed to equal it.

Response fields

data is an array of tools. Each item contains four fields:

mcp_codestring

MCP code. Can be used as the mcpCode path parameter

tool_namestring

Tool name. Can be used as the tool_name when calling a tool

tool_descriptionstring / null

Tool description

tool_input_schemaobject / null

Tool input schema. The structure is the same as inputSchema in List tools

Example

curl -G "https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/mcp/servers/tools/recommend" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  --data-urlencode "query=Query an order by order ID" \
  --data-urlencode "topN=5"

Response example

{
  "success": true,
  "error_code": null,
  "error_msg": null,
  "data": [
    {
      "mcp_code": "mcp-a1b2c3d4e5f6g7h8",
      "tool_name": "getOrder",
      "tool_description": "Queries an order by order ID",
      "tool_input_schema": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "description": "Order ID"
          }
        },
        "required": ["orderId"],
        "additionalProperties": false
      }
    }
  ],
  "request_id": "6f1c2a8e-3b0d-4c55-9a0e-2f7d1c9b8a11"
}

Error codes

HTTP statuserror_codeDescription
400InvalidParameterquery is missing or blank, or an unsupported query parameter is provided
502McpUpstreamErrorThe downstream MCP operation failed

NoteA recommendation does not mean the service is activated. Calling a One Key MCP tool may activate the service automatically and incur charges.