liveBook · Manning

@Tool annotation

A tool annotation is metadata attached to a method or tool definition that marks it as invocable and describes its operation and characteristics to clients or AI systems.

How 2 Manning books explain it

Spring AI in Action

The @Tool annotation marks a method as a callable tool that an AI application can expose to a language model.

How it is used
Exposes Spring-managed Java methods so language models can request real-time data, repository queries, or external capabilities.
How deep it goes
Explains annotation metadata, parameter descriptions, registration points, invocation flow, and method security without detailing framework internals.
Examples
Uses time-zone lookup, board-game complexity queries, prompt registration, MCP exposure, and secured premium-user access.
What you can do after
Build callable Spring AI tools from annotated Java methods and register or secure them for model-driven application requests.

Read how Spring AI in Action explains @Tool annotation →

Software Testing with Generative AI

A LangChain4j annotation that marks a method as an invocable tool and supplies natural-language metadata describing its operation.

How it is used
Marks methods as LLM-callable tools and describes when their operations match user instructions.
How deep it goes
Explains annotation-based method matching, parameter extraction, registration, and execution, but does not detail model decision internals.
Examples
Demonstrates room creation, booking creation, database display, and a combined prompt requesting all three operations.
What you can do after
Apply it via LangChain4j to expose Java methods that an LLM can select and invoke from natural-language prompts.

Read how Software Testing with Generative AI explains @Tool annotation →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.