Parameter annotation uses LangChain4j’s @P annotation to give a tool method parameter natural-language context. The language model matches that description to a prompt, extracts a value, and passes it to the method. section 9.2.1
Extracting a room count
A tool can declare createRooms(@P("Amount of room records to create") int count). Given “Can you create me 4 rooms,” the model selects the room-creation tool and supplies 4 as count. section 9.2.1
public class DataAssistantTools {
@Tool("Create room records")
public void createRooms(@P("Amount of room records to create")
➥int count) {
System.out.println("You want me to create " + count + "
➥rooms.");
}
@Tool("Create booking records")
public void createBookings(@P("Amount of booking records to
➥create") int count) {
System.out.println("You want me to create " + count + "
➥bookings.");
}
@Tool("Show results of database")
public void displayDatabase() {
System.out.println("I'll then share current database
➥details");
}
}
Inspect the Java tool definitions showing @P descriptions for room and booking counts alongside @Tool descriptions. section 9.2.1
Descriptions improve relevance matching but do not make model decisions transparent; failures can be difficult to diagnose because LLM decision-making is opaque. section 9.4
