Class HigressToolSearchResult

java.lang.Object
io.agentscope.extensions.higress.HigressToolSearchResult

public class HigressToolSearchResult extends Object
Represents the result of calling the x_higress_tool_search tool.

The x_higress_tool_search tool returns a list of recommended tools based on semantic similarity to the query. This class provides methods to parse and access the search results.

Example response structure from Higress:


 {
   "content": [
     {
       "type": "text",
       "text": "{\"tools\":[...]}"
     }
   ],
   "structuredContent": {
     "tools": [
       {
         "name": "map___maps_weather",
         "description": "根据城市名称或者标准adcode查询指定城市的天气",
         "title": "maps_weather",
         "inputSchema": {...},
         "outputSchema": {}
       }
     ]
   }
 }
 
  • Method Details

    • parse

      public static HigressToolSearchResult parse(io.modelcontextprotocol.spec.McpSchema.CallToolResult callToolResult)
      Parses the tool search result from MCP CallToolResult.
      Parameters:
      callToolResult - the result from calling x_higress_tool_search
      Returns:
      parsed HigressToolSearchResult
    • isSuccess

      public boolean isSuccess()
      Returns whether the search was successful.
      Returns:
      true if successful
    • getErrorMessage

      public String getErrorMessage()
      Returns the error message if the search failed.
      Returns:
      error message, or null if successful
    • getTools

      Returns the list of recommended tools.
      Returns:
      list of tools, never null but may be empty
    • getToolNames

      public List<String> getToolNames()
      Returns the names of all found tools.
      Returns:
      list of tool names
    • toString

      public String toString()
      Overrides:
      toString in class Object