@@ -19,32 +19,37 @@ description: |
1919 - Assets are outside Google Cloud
2020license : Apache-2.0
2121metadata :
22- version : v1
22+ version : v4
2323 publisher : google
2424---
2525
2626# Instructions
2727
28- ## Step 1: Handle Public Datasets or Proceed to Search
28+ ## Step 1: Prioritize Assets from the Conversation
2929
30- Dataplex Entries Lookup provides the richest metadata for data assets. You MUST
30+ If the asset was created or mentioned earlier in the same conversation, then
31+ proceed with that asset instead of searching. Skip steps 2, 3, and 4.
32+
33+ ## Step 2: Handle Public Datasets or Proceed to Search
34+
35+ Dataplex Lookup Context provides the richest metadata for data assets. You MUST
3136prioritize using it for all Google Cloud assets, even if you already know their
3237IDs.
3338
3439- ** Public Datasets (Direct Inspection)** : If the requested asset belongs to
35- the ` bigquery-public-data ` project, Dataplex Entries Lookup will fail. You
36- MUST skip Steps 2 and 3 and inspect the table directly using the ` bq ` CLI or
40+ the ` bigquery-public-data ` project, Dataplex Lookup Context will fail. You
41+ MUST skip Steps 3 and 4 and inspect the table directly using the ` bq ` CLI or
3742 BigQuery MCP tools instead.
38- - ** All Other Assets (Proceed to Step 2 )** : For all other BigQuery, Cloud
43+ - ** All Other Assets (Proceed to Step 3 )** : For all other BigQuery, Cloud
3944 Storage, Spanner, BigLake Iceberg or general GCP data assets (whether their
40- IDs are known or missing), you MUST proceed to ** Step 2 ** to search the
45+ IDs are known or missing), you MUST proceed to ** Step 3 ** to search the
4146 Dataplex catalog and obtain their full Entry Name.
4247
43- ## Step 2 : Execute Discovery Search
48+ ## Step 3 : Execute Discovery Search
4449
4550You MUST use the Dataplex search command to discover assets and retrieve their
4651full ` projects/... ` entry names. This step is required even if you already know
47- the asset's short ID (e.g., ` my_dataset.my_table ` ), because Step 3 strictly
52+ the asset's short ID (e.g., ` my_dataset.my_table ` ), because Step 4 strictly
4853requires the full entry name.
4954
5055> [ !IMPORTANT] The ` --project ` parameter MUST ALWAYS be provided. This
@@ -86,8 +91,9 @@ Use this for exact keyword matches or technical strings (e.g., `name:order_v2`).
8691 - Use ` : ` for token/substring matches (e.g., ` name:sales ` ).
8792 - Use ` = ` for exact matches. REQUIRED for ` system ` , ` type ` , and
8893 ` location ` .
89- - ** Singular Keywords** : ALWAYS convert plurals to singular (e.g., "product"
90- NOT "products").
94+ - ** Singular Keywords** : When performing keyword search, ALWAYS convert
95+ plurals to singular (e.g., "product" NOT "products"). Semantic search
96+ handles singular/plural variations and synonyms automatically.
9197- ** Scope Restriction** : You SHOULD restrict the search scope using a ` parent `
9298 filter if the project or dataset is known (e.g.,
9399 ` parent:projects/<PROJECT_ID> ` ).
@@ -126,26 +132,50 @@ gcloud dataplex entries search "<KEYWORD_SEARCH_QUERY>" \
126132 --limit=50
127133```
128134
129- * Criteria* : Once candidate assets are returned, proceed to Step 3 using the
135+ > [ !IMPORTANT] Handling Search Results and Avoiding Loops:
136+ >
137+ > 1 . ** No Results:** If the search returns no entries:
138+ > * ** Variation Rule:** You may try AT MOST 3 variations of the search
139+ > query (e.g., switching AND/OR clauses, adding/removing ` parent: ` ,
140+ > removing ` projectid: ` or ` location: ` , trying ` fully_qualified_name= ` ).
141+ > * ** Stop Rule:** If after 3 attempts no results are found, STOP and
142+ > inform the user. Ask for clarification, specifically the Dataplex
143+ > ** full entry name** if known, or identifiers such as ** project ID** ,
144+ > ** dataset ID** , or ** instance ID** to help narrow the search. Example:
145+ > "I couldn't find any tables matching that description after several
146+ > attempts. If you know the Dataplex full entry name (` projects/... ` ),
147+ > please provide it. Otherwise, please provide any identifiers you know,
148+ > such as project, dataset, or instance name, to help locate the asset."
149+ > 2 . ** Multiple Results:**
150+ > * If more than 10 results are returned, state that many matches were
151+ > found. Show the names of the first 5 entries and ask for
152+ > clarification.
153+ > * If 2-10 results are returned and you cannot definitively choose, list
154+ > them and ask the user.
155+ > 3 . ** Single Result:** Proceed to Step 3 with the full entry name.
156+ > 4 . ** Avoid Infinite Loops:** MUST NOT re-run identical or near-identical
157+ > queries. If Dataplex fails to return the expected asset, prioritize asking
158+ > the user for the exact resource ID or using Fallback 2 (Native Tools).
159+
160+ * Criteria* : Once candidate assets are returned, proceed to Step 4 using the
130161** full entry names** from the search results.
162+ ## Step 4: Lookup Context
131163
132- ## Step 3: Lookup Entry
133-
134- You MUST use the ** Entries Lookup** command to fetch schema and deep metadata
135- for the relevant results obtained from Step 2.
164+ You MUST use the ** Lookup Context** command to fetch schema and deep metadata
165+ for the relevant results obtained from Step 3.
136166
137- > [ !IMPORTANT] The argument MUST be the ** name** (starting with ` projects/ ` )
138- > returned by the search result. Passing short table IDs, GCS URIs, or fully
139- > qualified ` bigquery: ` prefixes is PROHIBITED and will fail.
167+ > [ !IMPORTANT] The ` --resources ` parameter MUST be the ** full name** (starting
168+ > with ` projects/ ` ) returned by the search result. Passing short table IDs, GCS
169+ > URIs, or fully qualified ` bigquery: ` prefixes is PROHIBITED and will fail.
140170
141171### Command Execution
142172
143- Use the ` lookup_entry ` MCP tool
173+ Use the ` lookup_context ` MCP tool
144174
145175OR
146176
147177``` bash
148- gcloud dataplex entries lookup " <FULL_ENTRY_NAME>"
178+ gcloud dataplex context lookup --resources= " <FULL_ENTRY_NAME>"
149179```
150180
151181* Completion Criteria* : The command returns the detailed schema and business
@@ -155,7 +185,7 @@ context.
155185
156186## Troubleshooting
157187
158- ### Lookup Fails or "Resource not found"
188+ ### Context Lookup Fails or "Resource not found"
159189
160190- ** Cause** : Short table names were used improperly.
161191- ** Fix** : Ensure you use the correct entry name format from the search
@@ -167,12 +197,24 @@ context.
167197- ** Fix** : Switch to singular keywords. For semantic search, try more
168198 descriptive natural language.
169199
170- ### Lookup Fails with "NOT_FOUND" (despite correct format)
200+ ### Context Lookup Fails with "NOT_FOUND" (despite correct format)
171201
172202- ** Cause** : The table belongs to a project (e.g., ` bigquery-public-data ` )
173203 that has not fully synchronized its metadata with the Dataplex Universal
174- Catalog. While the entry appears in search, ` entries lookup` is unavailable.
204+ Catalog. While the entry appears in search, ` context lookup` is unavailable.
175205- ** Fix** : Fall back to direct inspection using native tools (e.g., ` bq ` CLI).
206+ - ** Stop Rule:** If the native tool (e.g., ` bq show ` ) also returns "Not
207+ Found", STOP. Do not restart the Dataplex discovery loop. Specifically ask
208+ the user to verify the ** project ID** and ** table ID** .
209+
210+ ### Breaking the Research Loop
211+
212+ If you find yourself repeatedly searching for the same asset:
213+
214+ 1 . ** STOP.**
215+ 2 . State what you have tried (e.g., "I tried searching Dataplex with X and Y,
216+ and checked ` bq show ` ").
217+ 3 . Ask the user for the exact project, dataset, and table ID.
176218
177219### Search Fails with "--project: Must be specified."
178220
0 commit comments