fix(get_entities): handles when the array of urns is passed as string with json#59
Open
fix(get_entities): handles when the array of urns is passed as string with json#59
Conversation
mayurinehate
requested changes
Nov 20, 2025
|
|
||
| # 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 |
Contributor
There was a problem hiding this comment.
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.
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.
No description provided.