fix(agentgateway): handle empty MCP tool list - #299
Open
ricardosrib wants to merge 5 commits into
Open
Conversation
tiagoek
reviewed
Sep 1, 2026
Contributor
SDK Module Review
Findings (1)
1 finding(s): 1 posted as inline comment(s) on the affected lines, 0 not tied to a code line (listed above). Generated by sdk-review-skill · v1 |
cassiofariasmachado
previously approved these changes
Sep 1, 2026
NicoleMGomes
previously approved these changes
Sep 1, 2026
ricardosrib
dismissed stale reviews from NicoleMGomes and cassiofariasmachado
via
September 1, 2026 22:03
401de37
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.
Description
Fixes unexpected errors in agent gateway – LoB and customer flows – when an MCP server returns no tools.
Two issues were addressed:
result.tools:session.list_tools()can returnNonefortoolsinstead of an empty list. Iterating directly overNoneraised aTypeError. Addedresult.tools or []in both_lob.pyand_customer.pyto handle bothNoneand empty list safely.info-level log is emitted ("No tools returned by AGW for fragment '...'") so the absence of tools is observable without raising an error.Type of Change
How to Test
.venv/bin/pytest tests/agentgateway/unit/test_lob.py::TestListServerTools -vtest_returns_empty_list_and_logs_when_no_tools— returns[]and emits info logtest_returns_tools_with_server_info_name— normal tools returned correctlytest_falls_back_to_fragment_name_when_server_info_missing— fallback whenserverInfois absentChecklist
Additional Notes
The fix applies to both
_lob.py(LoB flow) and_customer.py(customer flow) since both had the same missing null guard onresult.tools.