Skip to content

fix(get_entities): handles when the array of urns is passed as string with json#59

Open
alexsku wants to merge 1 commit intomainfrom
sa-get_entities-string-json-fix
Open

fix(get_entities): handles when the array of urns is passed as string with json#59
alexsku wants to merge 1 commit intomainfrom
sa-get_entities-string-json-fix

Conversation

@alexsku
Copy link
Contributor

@alexsku alexsku commented Nov 20, 2025

No description provided.

@alexsku alexsku requested a review from mayurinehate November 20, 2025 04:05

# Handle single URN for backward compatibility
# Handle JSON-stringified arrays (same issue as filters in search tool)
# Some MCP clients/LLMs pass arrays as JSON strings instead of proper lists
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a common problem. We had to handle this at some other places as well (e.g. compile_filters).

WDYT about having a helper written such as parse_as_form(input_structure:Any, expected_type:Type) that returns instance of Type. The implementation can use repair_json and/or pydantic validators. I think, this helper will be useful at multiple places and will make the code cleaner and maintainable.

Alternatively, even if not generic parser, for now, can you please separate this parsing into a separate method that takes care of all parsing urns input arg and returning expected List[str] . This method should then also be unit tested.

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.

2 participants