tools method

MessageBuilder tools(
  1. List<Tool> tools
)

Add tools to this message

This allows tools to be associated with specific messages, enabling provider-specific caching and processing.

Example:

MessageBuilder.system()
    .tools([tool1, tool2, tool3])
    .anthropicConfig((anthropic) => anthropic.cache())  // Cache the tools
    .build();

Implementation

MessageBuilder tools(List<Tool> tools) {
  // Add a special block to store tools for provider processing
  addBlock(ToolsBlock(tools));
  return this;
}