-
Notifications
You must be signed in to change notification settings - Fork 21
Tool: Create Data Domains/Sub Domains/Products #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| ) | ||
| else: | ||
| logger.debug(f"Creating DataDomain: {spec.name}") | ||
| domain = DataDomain.creator(name=spec.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just pass None if it doesn't exist and remove this if condition?
|
|
||
| domain.user_description = spec.user_description | ||
|
|
||
| if spec.certificate_status: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| assets: List[DataProduct] = [] | ||
| for spec in specs: | ||
| # Validate that asset_guids is provided and not empty | ||
| if not spec.asset_guids: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add these validations as part of the DataProductSpec pydantic model
| logger.debug(f"Linking {len(spec.asset_guids)} asset(s) to product") | ||
|
|
||
| # Build FluentSearch to select assets by their GUIDs | ||
| asset_selection = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the complete asset list to create the data product?
| ) | ||
| product.user_description = spec.user_description | ||
|
|
||
| if spec.certificate_status: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as DataDomain
| return save_assets(assets) | ||
|
|
||
|
|
||
| def create_domain_assets( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just create 2 different tools?
| logger.error(f"Error saving assets: {e}") | ||
| raise | ||
|
|
||
| created_assets = response.mutated_entities.CREATE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets also return updated assets. If we are making this function lets use it elsewhere as well where we are directly saving
|
|
||
|
|
||
| @mcp.tool() | ||
| def create_domains(items) -> List[Dict[str, Any]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets create 2 tools, one for domains and one for products
This pull request adds support for creating Data Domains, Sub Domains, and Data Products in Atlan via a new unified tool and supporting backend logic. The changes introduce new models, backend asset creation logic, and expose the new functionality through the server and tool initialization files.
New functionality for domain-related asset creation:
create_domainsto the server, allowing creation of Data Domains, Sub Domains, and Data Products with a unified interface that auto-detects the type based on the input fields. The tool includes comprehensive documentation and examples.create_domain_assetsin the tool initialization and server, making it available for use. [1] [2] [3]Backend implementation and models:
modelcontextprotocol/tools/domain.py, which provides functions to create Data Domains, Sub Domains, and Data Products, including input parsing, model instantiation, and bulk asset saving with logging and error handling.DataDomainSpec,DataSubDomainSpec,DataProductSpec) to validate and structure payloads for the new asset types.