mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-29 07:14:20 +00:00
Ensure clients see MCP auth errors
Signed-off-by: Ben Browning <bbrownin@redhat.com>
This commit is contained in:
parent
7ca51640eb
commit
4867ed21b5
1 changed files with 7 additions and 1 deletions
|
@ -8,7 +8,7 @@ from typing import Any
|
||||||
|
|
||||||
from llama_stack.apis.common.content_types import URL
|
from llama_stack.apis.common.content_types import URL
|
||||||
from llama_stack.apis.tools import ListToolGroupsResponse, ListToolsResponse, Tool, ToolGroup, ToolGroups
|
from llama_stack.apis.tools import ListToolGroupsResponse, ListToolsResponse, Tool, ToolGroup, ToolGroups
|
||||||
from llama_stack.distribution.datatypes import ToolGroupWithOwner
|
from llama_stack.distribution.datatypes import AuthenticationRequiredError, ToolGroupWithOwner
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
|
||||||
from .common import CommonRoutingTableImpl
|
from .common import CommonRoutingTableImpl
|
||||||
|
@ -56,7 +56,13 @@ class ToolGroupsRoutingTable(CommonRoutingTableImpl, ToolGroups):
|
||||||
if toolgroup.identifier not in self.toolgroups_to_tools:
|
if toolgroup.identifier not in self.toolgroups_to_tools:
|
||||||
await self._index_tools(toolgroup)
|
await self._index_tools(toolgroup)
|
||||||
all_tools.extend(self.toolgroups_to_tools[toolgroup.identifier])
|
all_tools.extend(self.toolgroups_to_tools[toolgroup.identifier])
|
||||||
|
except AuthenticationRequiredError:
|
||||||
|
# Send authentication errors back to the client so it knows
|
||||||
|
# that it needs to supply credentials for remote MCP servers.
|
||||||
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
# Other errors that the client cannot fix are logged and
|
||||||
|
# those specific toolgroups are skipped.
|
||||||
logger.warning(f"Error listing tools for toolgroup {toolgroup.identifier}: {e}")
|
logger.warning(f"Error listing tools for toolgroup {toolgroup.identifier}: {e}")
|
||||||
logger.debug(e, exc_info=True)
|
logger.debug(e, exc_info=True)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue