Repository navigation
fix(gti-mcp): return relationship errors from the other related-entities tools - #343
Merged
Merged
Conversation
…ies tools get_entities_related_to_a_domain, _an_ip_address, _an_url, _a_collection and _a_hunting_ruleset return an error dict for an unknown relationship_name, but their list-only return annotations make FastMCP's output validation reject it, so the caller gets a ToolError instead of the list of valid relationships. Use the same Union annotation that get_entities_related_to_a_file got in google#335. Signed-off-by: KVR Vishnu <46535652+VISHNU0906@users.noreply.github.com>
dandye
approved these changes
Nov 10, 2026
dandye
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for catching the remaining five tools and adding the parametrized client-session regression test. LGTM, merging now.
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.
#335 fixed this for
get_entities_related_to_a_file; the other five related-entities tools still have it.get_entities_related_to_a_domain,_an_ip_address,_an_url,_a_collectionand_a_hunting_rulesetreturn{"error": "Relationship X does not exist. Available relationships are: ..."}for an unknownrelationship_name, but they are annotated as returning a list. FastMCP validates the return value against that output schema, so the client gets this instead of the error dict:That hides the list of valid relationships, which is what the model needs to retry. This PR gives the five tools the same
Union[List[Dict], Dict[str, str]]return annotation the file tool has now and notes the error dict in their docstrings.Testing: a new parametrized test calls each tool through the MCP client session with an unknown relationship and checks the error dict comes back; all five cases fail on main with the validation error above. The full
server/gtisuite passes (72 tests).@dandye could you take a look when you have a moment?