Enum Class ToolAnnotation

Object
Enum<ToolAnnotation>
akka.javasdk.annotations.mcp.ToolAnnotation
All Implemented Interfaces:
Serializable, Comparable<ToolAnnotation>, Constable

public enum ToolAnnotation extends Enum<ToolAnnotation>
Behavioral annotations that describe MCP tool characteristics to clients.

These annotations provide hints about tool behavior to help AI models make informed decisions about when and how to use tools. They describe properties like whether a tool modifies data, can be called repeatedly safely, or interacts with external systems.

Usage: Apply these annotations to McpTool methods via the McpTool.annotations() attribute to help clients understand tool behavior patterns.

Security Note: All values are hints only and are not guaranteed to provide a faithful description of actual tool behavior. Clients should never make security-critical tool use decisions based on ToolAnnotations received from untrusted servers.

Annotation Pairs: Annotations are defined as opposites to allow clear specification in Java annotations:

  • Enum Constant Details

    • Destructive

      public static final ToolAnnotation Destructive
      The tool may perform destructive updates to its environment. Opposite of "NonDestructive".
    • NonDestructive

      public static final ToolAnnotation NonDestructive
      If false, the tool performs only additive updates. Opposite of "Destructive".
    • Idempotent

      public static final ToolAnnotation Idempotent
      Calling the tool repeatedly with the same arguments will have no additional effect on the environment. Opposite of "NonIdempotent".
    • NonIdempotent

      public static final ToolAnnotation NonIdempotent
      Calling the tool repeatedly with the same arguments will affect the environment each time. Opposite of "Idempotent".
    • OpenWorld

      public static final ToolAnnotation OpenWorld
      This tool may interact with an \"open world\" of external entities. Opposite of "ClosedWorld".

      For example, the world of a web search tool is open.

    • ClosedWorld

      public static final ToolAnnotation ClosedWorld
      The tool's domain of interaction is closed. Opposite of "OpenWorld".

      For example, a memory tool is non-open-world

    • ReadOnly

      public static final ToolAnnotation ReadOnly
      The tool does not modify its environment. Opposite of "Mutating"
    • Mutating

      public static final ToolAnnotation Mutating
      The tool does modify its environment. Opposite of "ReadOnly".
  • Method Details

    • values

      public static ToolAnnotation[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ToolAnnotation valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null