2727@mcp .tool ()
2828def search_assets_tool (
2929 conditions = None ,
30+ custom_metadata_conditions = None ,
3031 negative_conditions = None ,
3132 some_conditions = None ,
3233 min_somes = 1 ,
@@ -50,6 +51,8 @@ def search_assets_tool(
5051 Args:
5152 conditions (Dict[str, Any], optional): Dictionary of attribute conditions to match.
5253 Format: {"attribute_name": value} or {"attribute_name": {"operator": operator, "value": value}}
54+ custom_metadata_conditions (List[Dict[str, Any]], optional): List of custom metadata conditions to match.
55+ Format: [{"custom_metadata": value}] or [{"custom_metadata": {"operator": operator, "value": value}}]
5356 negative_conditions (Dict[str, Any], optional): Dictionary of attribute conditions to exclude.
5457 Format: {"attribute_name": value} or {"attribute_name": {"operator": operator, "value": value}}
5558 some_conditions (Dict[str, Any], optional): Conditions for where_some() queries that require min_somes of them to match.
@@ -95,6 +98,15 @@ def search_assets_tool(
9598 include_attributes=["owner_users", "owner_groups"]
9699 )
97100
101+ # Search for assets with custom metadata
102+ asset_list_1 = search_assets(
103+ custom_metadata_conditions=[{"custom_metadata_filter": {"display_name": "test-mcp", "property_filters": [{"property_name": "mcp_allow_status", "property_value": "yes"}]}}]
104+ )
105+
106+ asset_list_2 = search_assets(
107+ custom_metadata_conditions=[{"custom_metadata_filter": {"display_name": "test-mcp", "property_filters": [{"property_name": "mcp_allow_status", "property_value": "yes", "operator": "eq"}]}}]
108+ )
109+
98110 # Search for columns with specific certificate status
99111 columns = search_assets(
100112 asset_type="Column",
@@ -219,6 +231,7 @@ def search_assets_tool(
219231 try :
220232 # Parse JSON string parameters if needed
221233 conditions = parse_json_parameter (conditions )
234+ custom_metadata_conditions = parse_json_parameter (custom_metadata_conditions )
222235 negative_conditions = parse_json_parameter (negative_conditions )
223236 some_conditions = parse_json_parameter (some_conditions )
224237 date_range = parse_json_parameter (date_range )
@@ -229,6 +242,7 @@ def search_assets_tool(
229242
230243 return search_assets (
231244 conditions ,
245+ custom_metadata_conditions ,
232246 negative_conditions ,
233247 some_conditions ,
234248 min_somes ,
@@ -683,42 +697,42 @@ def create_glossary_categories(categories) -> List[Dict[str, Any]]:
683697def detect_custom_metadata_from_query (query_text : str ) -> Dict [str , Any ]:
684698 """
685699 Detect custom metadata triggers from natural language queries.
686-
687- This tool analyzes natural language text to identify when users are referencing
688- custom metadata (business metadata) and automatically provides context about
700+
701+ This tool analyzes natural language text to identify when users are referencing
702+ custom metadata (business metadata) and automatically provides context about
689703 available custom metadata definitions. Use this tool when you receive natural
690704 language queries that might involve custom metadata concepts.
691-
705+
692706 Args:
693707 query_text (str): Natural language query text to analyze for custom metadata references
694-
708+
695709 Returns:
696710 Dict[str, Any]: Dictionary containing:
697711 - detected: Boolean indicating if custom metadata was detected
698712 - context: Custom metadata context if detected (list of metadata definitions)
699713 - detection_reasons: List of reasons why custom metadata was detected
700714 - suggested_attributes: List of suggested custom metadata attributes
701-
715+
702716 Detection Triggers:
703717 The tool detects custom metadata usage when the query contains:
704718 - Business metadata keywords (e.g., "business metadata", "data classification")
705719 - Data governance terms (e.g., "PII", "GDPR", "compliance", "data quality")
706720 - Attribute patterns (e.g., "sensitivity level", "business owner", "data steward")
707721 - Quality and classification terms (e.g., "quality score", "classification level")
708-
722+
709723 Examples:
710724 # Query mentioning data classification
711725 result = detect_custom_metadata_from_query("Find all tables with sensitive data classification")
712-
726+
713727 # Query about data quality
714728 result = detect_custom_metadata_from_query("Show me assets with poor data quality scores")
715-
729+
716730 # Query about business ownership
717731 result = detect_custom_metadata_from_query("Which datasets have John as the business owner?")
718-
732+
719733 # Query about compliance
720734 result = detect_custom_metadata_from_query("Find all PII data that needs GDPR compliance review")
721-
735+
722736 Use Cases:
723737 - Analyze user queries before executing searches to provide custom metadata context
724738 - Understand when users are asking about business metadata attributes
@@ -733,7 +747,7 @@ def detect_custom_metadata_from_query(query_text: str) -> Dict[str, Any]:
733747 "context" : None ,
734748 "detection_reasons" : [],
735749 "suggested_attributes" : [],
736- "error" : f"Failed to detect custom metadata: { str (e )} "
750+ "error" : f"Failed to detect custom metadata: { str (e )} " ,
737751 }
738752
739753
0 commit comments