llama-stack-mirror/tests/unit/distribution
Ben Browning c658c5912c
fix: Gracefully handle errors when listing MCP tools
When listing (and lazily indexing) tools, it's possible for an error
to get thrown by individual toolgroups if for example an MCP toolgroup
is unable to connect to its `mcp_endpoint`.

This logs a warning in the server when that happens, logs a full stack
trace of the error if debug logging is enabled, and just returns the
list of tools from all working toolgroups instead of throwing an error
to the client when a single toolgroup is temporarily or permanently
misbehaving.

Fixes #2540

A new unit test was added to test this exception handling, which is
run as part of our regular test suite but also manually run to
specifically verify this fix via:

```
uv run pytest -sv --asyncio-mode=auto \
tests/unit/distribution/routers/test_routing_tables.py
```

To verify the additional debug logging is printing properly:

```
LLAMA_STACK_LOGGING=core=debug \
uv run pytest -sv --asyncio-mode=auto \
tests/unit/distribution/routers/test_routing_tables.py
```

Signed-off-by: Ben Browning <bbrownin@redhat.com>
2025-09-26 16:48:59 +02:00
..
routers fix: Gracefully handle errors when listing MCP tools 2025-09-26 16:48:59 +02:00
routing_tables feat!: Migrate Vector DB IDs to Vector Store IDs (breaking change) (#3253) 2025-09-05 15:40:34 +02:00
test_build_path.py chore: rename templates to distributions (#3035) 2025-08-04 11:34:17 -07:00
test_context.py chore(rename): move llama_stack.distribution to llama_stack.core (#2975) 2025-07-30 23:30:53 -07:00
test_distribution.py feat: combine ProviderSpec datatypes (#3378) 2025-09-18 16:10:00 +02:00
test_inference_recordings.py chore(recorder): update mocks to be closer to non-mock environment (#3442) 2025-09-15 15:25:53 -04:00
test_library_client_initialization.py chore: refactor server.main (#3462) 2025-09-18 21:11:13 -07:00