Skip to content

fix(gti-mcp): return relationship errors from the other related-entities tools - #343

Merged
dandye merged 1 commit into
google:mainfrom
VISHNU0906:fix/gti-related-entities-errors
Nov 10, 2026
Merged

dandye merged 1 commit into
google:mainfrom
VISHNU0906:fix/gti-related-entities-errors

Conversation

@VISHNU0906

Copy link
Copy Markdown
Contributor

#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_collection and _a_hunting_ruleset return {"error": "Relationship X does not exist. Available relationships are: ..."} for an unknown relationship_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:

ToolError: Error executing tool get_entities_related_to_a_domain: 1 validation error for get_entities_related_to_a_domainOutput
result
  Input should be a valid list [type=list_type, ...]

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/gti suite passes (72 tests).

@dandye could you take a look when you have a moment?

…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>
@VISHNU0906
VISHNU0906 requested a review from a team November 10, 2026 01:33

@dandye dandye left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for catching the remaining five tools and adding the parametrized client-session regression test. LGTM, merging now.

@dandye
dandye merged commit d689e4e into google:main Nov 10, 2026
6 checks passed
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