Skip to content

fix: add list coercion for direction/include_attributes in traverse_lineage_tool#217

Open
mothership-ai[bot] wants to merge 1 commit intomainfrom
fix/AICHAT-829-list-coercion-traverse-lineage
Open

fix: add list coercion for direction/include_attributes in traverse_lineage_tool#217
mothership-ai[bot] wants to merge 1 commit intomainfrom
fix/AICHAT-829-list-coercion-traverse-lineage

Conversation

@mothership-ai
Copy link
Copy Markdown

@mothership-ai mothership-ai bot commented Apr 2, 2026

Session owner: @abhinavmathur-atlan

Summary

  • Add list-to-string coercion for direction parameter in traverse_lineage_tool — if LLMs pass ["upstream"] instead of "upstream", extract the single element; if multiple values, return a helpful error
  • Add string-to-list coercion for include_attributes — if LLMs pass a plain string instead of a list, coerce it through parse_list_parameter
  • Catch AttributeError alongside KeyError in direction parsing to handle non-string types gracefully

Context

LLMs naturally produce JSON lists for these parameters (~50 validation errors/30d). This adds defensive coercion at the tool entry point without changing the underlying traverse_lineage function.

Closes AICHAT-829

Test plan

  • Verify direction="UPSTREAM" still works (string passthrough)
  • Verify direction=["upstream"] is coerced to "upstream"
  • Verify direction=["upstream", "downstream"] raises a clear ValueError
  • Verify include_attributes="name" is coerced to ["name"]
  • Verify include_attributes=["name", "description"] still works

🤖 Generated with Claude Code

…ineage_tool

LLMs naturally pass direction and include_attributes as JSON lists
(e.g. ["upstream"]) but the schema expects strings. This caused ~50
validation errors per 30 days.

- If direction is a single-element list, extract the value
- If direction is a multi-element list, return a helpful error
- If include_attributes is a string, coerce it through parse_list_parameter
- Catch AttributeError alongside KeyError for non-string direction values

Closes AICHAT-829

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mothership-ai mothership-ai bot requested review from Hk669 and firecast as code owners April 2, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant