Class McpToolPluginUtils
java.lang.Object
io.meeds.mcp.server.tool.util.McpToolPluginUtils
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe largest page a list tool returns, whatever limit its caller asks for. -
Method Summary
Modifier and TypeMethodDescriptionstatic intclampLimit(Integer limit, int defaultValue) Computes the page size a list tool applies: the default one when the caller asked for none, or for zero or less, and never more thanMAX_LIMIT.static intclampLimit(Integer limit, int defaultValue, int max) Computes the page size a list tool applies: the default one when the caller asked for none, or for zero or less, and never more thanmax.static intgetInteger(Integer i, int defaultValue) static StringtransformHtmlContent(String htmlText, org.exoplatform.services.security.Identity aclIdentity, Locale locale) Transforms an HTML text the way the platform renders it for a viewer.
-
Field Details
-
MAX_LIMIT
public static final int MAX_LIMITThe largest page a list tool returns, whatever limit its caller asks for.- See Also:
-
-
Method Details
-
getInteger
- Parameters:
i- the value a tool received, may benulldefaultValue- the value to use when none, or zero, was received- Returns:
- the received value, or the default one when it is
nullor zero
-
clampLimit
Computes the page size a list tool applies: the default one when the caller asked for none, or for zero or less, and never more thanMAX_LIMIT.- Parameters:
limit- the limit the caller asked for, may benulldefaultValue- the page size to use when the caller asked for none- Returns:
- the page size to apply, at most
MAX_LIMIT
-
clampLimit
Computes the page size a list tool applies: the default one when the caller asked for none, or for zero or less, and never more thanmax.- Parameters:
limit- the limit the caller asked for, may benulldefaultValue- the page size to use when the caller asked for nonemax- the largest page size the tool returns- Returns:
- the page size to apply
-
transformHtmlContent
public static String transformHtmlContent(String htmlText, org.exoplatform.services.security.Identity aclIdentity, Locale locale) Transforms an HTML text the way the platform renders it for a viewer.- Parameters:
htmlText- the HTML textaclIdentity- the viewer's identitylocale- the viewer's locale- Returns:
- the transformed HTML text
-