fix(mcp): fix silent column filter drop and bulk search sort error (AICHAT-1117)#229
Open
abhinavmathur-atlan wants to merge 2 commits into
Open
fix(mcp): fix silent column filter drop and bulk search sort error (AICHAT-1117)#229abhinavmathur-atlan wants to merge 2 commits into
abhinavmathur-atlan wants to merge 2 commits into
Conversation
…ICHAT-1117) Two bugs when searching columns via MCP: 1. Unknown condition attributes (e.g. __parentQualifiedName) were silently dropped with a warning, causing the search to run with no filters and return unrelated columns. Now returns an explicit error with hints — for the __parentQualifiedName case, points the LLM to viewQualifiedName / tableQualifiedName / qualifiedName startsWith. 2. LLM-added sort_by (e.g. sort_by=order) succeeded attribute lookup but was rejected at execution time when pyatlan switched to bulk search mode (ATLAN-PYTHON-400-063). Now catches the bulk search exception and retries transparently without sort so results are still returned. Also updates search_assets_tool docstring to guide the LLM toward correct field names for column parent filtering and to document the sort_by limitation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…hint _get_asset_attribute previously did a raw .upper() on the input, so camelCase names like 'viewQualifiedName' resolved to 'VIEWQUALIFIEDNAME' instead of 'VIEW_QUALIFIED_NAME', silently returning None for valid fields. Now strips leading ES-internal underscores (__parentQualifiedName -> parentQualifiedName) and converts camelCase to UPPER_SNAKE_CASE before the getattr lookup, so both 'qualified_name' and 'qualifiedName' resolve correctly. Also corrects the __parentQualifiedName error hint to recommend the actually- working approach: 'qualified_name' with operator 'startsWith' and value '<parent_qn>/' — which reliably resolves via Asset.QUALIFIED_NAME on base Asset, unlike viewQualifiedName which is defined on Column not Asset. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two bugs reported in AICHAT-1117 where searching columns of a Databricks view via Atlan MCP returned wrong results or errored.
Bug 1 —
__parentQualifiedNamesilently ignored → wrong columns returnedSearchUtils._get_asset_attribute("__parentQualifiedName")resolves togetattr(Asset, "__PARENTQUALIFIEDNAME", None)→None. The condition was silently skipped (warning-only), so the search ran with zero filters and returned unrelated columns from across the tenant.Fix: return an explicit error dict with actionable hints instead of silently continuing. For
__parentQualifiedNamespecifically, the hint points the LLM to the correct fields:viewQualifiedName,tableQualifiedName, orqualifiedNamewithstartsWith.Bug 2 —
sort_by=ordertriggers bulk search error (ATLAN-PYTHON-400-063)Asset.ORDERis a valid pyatlan attribute (column ordinal), so sort was applied. When the Column result set is large, pyatlan switches to bulk/scroll mode which rejects user-defined sort orders. No guard existed between sort application and bulk-mode execution.Fix: save pre-sort search state and catch the
400-063exception at execution time, retrying without sort. Results are returned correctly; ordering is silently dropped. The docstring now also documents this limitation.Files changed
modelcontextprotocol/tools/search.py— unknown-attr error with hints; bulk sort retrymodelcontextprotocol/server.py— docstring updates to guide LLM toward correct field namesTest plan
asset_type=Columnwithconditions: {viewQualifiedName: "<qn>"}— returns correct columnsasset_type=Columnwithconditions: {__parentQualifiedName: "<qn>"}— returns error with hint (not wrong columns)asset_type=Columnwithsort_by=orderon a large result set — returns results without error (sort silently dropped)sort_byon a small result set — sort still applied normallyCloses AICHAT-1117
🤖 Generated with Claude Code