Class McpToolNaming

java.lang.Object
com.axelor.ai.mcp.McpToolNaming

public final class McpToolNaming extends Object
Builds a stable, provider-safe AiTool.code for a synced MCP tool, formatted as <clientCode>_<sanitizedRemoteName> and capped at 64 characters. Disambiguation is always a deterministic hash, never a positional or ordering-dependent suffix.
  • Method Details

    • toolCode

      public static String toolCode(String clientCode, String remoteName)
      The preferred, readable code, kept verbatim when both halves survive sanitizing unchanged and fit, since this is what the model sees. Readability leaves the separator ambiguous, as "a_b" + "c" reads the same as "a" + "b_c", so a caller that persists the result must resolve a clash with uniqueCode(java.lang.String, java.lang.String) rather than assume this is unique.
    • uniqueCode

      public static String uniqueCode(String clientCode, String remoteName)
      Always appends a deterministic hash over both halves, so distinct client/tool pairs cannot collide however they sanitize. Lets the synchronizer resolve a clash instead of dropping a tool.