Package io.jmix.aitools.dataload.tool
Class DomainModelDiscoveryTool
java.lang.Object
io.jmix.aitools.dataload.tool.DomainModelDiscoveryTool
- All Implemented Interfaces:
DataLoadAiTool,EntityDataLoadAiTool,JmixAiTool
@Component("aitls_DomainModelDiscoveryTool")
public class DomainModelDiscoveryTool
extends Object
implements DataLoadAiTool, EntityDataLoadAiTool
Spring AI tool that lets the model discover the application's domain model: list the entities
available to the user and load detailed metadata for the chosen ones.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected AvailableEntityServicestatic final Stringprotected Messagesprotected AiToolStatusPublisher -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAvailableEntities(org.springframework.ai.chat.model.ToolContext toolContext) Lists the entities currently available to the user as compact summaries.getDomainModelForEntities(List<String> entityNames, org.springframework.ai.chat.model.ToolContext toolContext) Loads detailed metadata for the requested entity names, keeping only those available to the user.
-
Field Details
-
AVAILABLE_ENTITIES_TOOL
- See Also:
-
DOMAIN_MODEL_FOR_ENTITIES_TOOL
- See Also:
-
availableEntityService
-
toolStatusPublisher
-
messages
-
-
Constructor Details
-
DomainModelDiscoveryTool
public DomainModelDiscoveryTool()
-
-
Method Details
-
getAvailableEntities
@Tool(name="aitls_getAvailableEntities", description="Returns compact metadata for all entities currently available to the user.\nEach item contains entity name, localized names, property names and property localized names.\nEntities hidden by application filtering or security are not returned.\nThe result may be empty when the user has no available entities.\n\nUse this to:\n - Explore the currently available data model\n - Choose which exact entities should be inspected in more detail\n - Get correct entity names for follow-up tool calls\n") public List<EntitySummary> getAvailableEntities(org.springframework.ai.chat.model.ToolContext toolContext) Lists the entities currently available to the user as compact summaries.- Parameters:
toolContext- Spring AI tool context used to publish status updates- Returns:
- available entity summaries (empty if none)
-
getDomainModelForEntities
@Tool(name="aitls_getDomainModelForEntities", description="Returns detailed domain model metadata for the specified entity names that are currently available to the user.\nEntities hidden by application filtering or security are omitted from the result.\nThe result may be empty if none of the requested entities are available.\n\nMANDATORY: You MUST call this function for the entities you intend to query BEFORE any executeQuery() calls.\n\nReturns:\n- Exact attribute names (Java property names)\n- Entity relationships for JPQL joins\n- Property types and constraints\n- Enum properties in one map: enums.<ENUM_NAME>.id (+ optional enums.<ENUM_NAME>.description)\n\nENUM RULE (CRITICAL):\n - When filtering enum properties in executeQuery(), use enums.<ENUM_NAME>.id, not enum constant names.\n - Example: if enums.PAID.id is 40, then pass parameter 40 (not \"PAID\").\n") public List<EntityDescriptor> getDomainModelForEntities(@ToolParam(description="Exact entity names to load detailed metadata for.") List<String> entityNames, org.springframework.ai.chat.model.ToolContext toolContext) Loads detailed metadata for the requested entity names, keeping only those available to the user.- Parameters:
entityNames- exact entity names to load metadata fortoolContext- Spring AI tool context used to publish status updates- Returns:
- descriptors for the available requested entities (empty if none match)
-