Enum Class ToolAnnotation
- All Implemented Interfaces:
Serializable
,Comparable<ToolAnnotation>
,Constable
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe tool's domain of interaction is closed.The tool may perform destructive updates to its environment.Calling the tool repeatedly with the same arguments will have no additional effect on the environment.The tool does modify its environment.If false, the tool performs only additive updates.Calling the tool repeatedly with the same arguments will affect the environment each time.This tool may interact with an \"open world\" of external entities.The tool does not modify its environment. -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolAnnotation
Returns the enum constant of this class with the specified name.static ToolAnnotation[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
Destructive
The tool may perform destructive updates to its environment. Opposite of "NonDestructive". -
NonDestructive
If false, the tool performs only additive updates. Opposite of "Destructive". -
Idempotent
Calling the tool repeatedly with the same arguments will have no additional effect on the environment. Opposite of "NonIdempotent". -
NonIdempotent
Calling the tool repeatedly with the same arguments will affect the environment each time. Opposite of "Idempotent". -
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
The tool's domain of interaction is closed. Opposite of "OpenWorld".For example, a memory tool is non-open-world
-
ReadOnly
The tool does not modify its environment. Opposite of "Mutating" -
Mutating
The tool does modify its environment. Opposite of "ReadOnly".
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-