annotations property

ToolAnnotations? annotations
final

Optional behavioral annotations for this tool.

Provides hints to MCP clients about the tool's behavior — whether it is read-only, destructive, idempotent, or interacts with external systems. Clients may use these hints to surface approval dialogs or auto-permit safe operations.

Example:

@Tool(
  description: 'Get user by ID',
  annotations: ToolAnnotations(readOnlyHint: true),
)
Future<User?> getUser(int id) async { ... }

Implementation

final ToolAnnotations? annotations;