Package io.agentscope.extensions.higress
Class HigressToolSearchResult
java.lang.Object
io.agentscope.extensions.higress.HigressToolSearchResult
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": {}
}
]
}
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a single tool returned from the search. -
Method Summary
Modifier and TypeMethodDescriptionReturns the error message if the search failed.Returns the names of all found tools.getTools()Returns the list of recommended tools.booleanReturns whether the search was successful.static HigressToolSearchResultparse(io.modelcontextprotocol.spec.McpSchema.CallToolResult callToolResult) Parses the tool search result from MCP CallToolResult.toString()
-
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
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
Returns the names of all found tools.- Returns:
- list of tool names
-
toString
-