using llama stack client's list_tools

This commit is contained in:
Omar Abdelwahab 2025-11-14 14:24:17 -08:00
parent ddc18e568f
commit 8c595bebc1
2 changed files with 9 additions and 10 deletions

View file

@ -38,13 +38,10 @@ def test_mcp_invocation(llama_stack_client, text_model_id, mcp_server):
# Phase 2: Use the dedicated authorization parameter (no more provider_data headers) # Phase 2: Use the dedicated authorization parameter (no more provider_data headers)
# This tests direct tool_runtime.invoke_tool API calls # This tests direct tool_runtime.invoke_tool API calls
# Without authorization, should get Unauthorized error # Note: tools.list() is the ToolGroups API and doesn't have authorization parameter
with pytest.raises(Exception, match="Unauthorized"): # Use tool_runtime.list_tools() for authorization support
llama_stack_client.tools.list(toolgroup_id=test_toolgroup_id) tools_list = llama_stack_client.tool_runtime.list_tools(
tool_group_id=test_toolgroup_id,
# With authorization parameter, should succeed
tools_list = llama_stack_client.tools.list(
toolgroup_id=test_toolgroup_id,
authorization=AUTH_TOKEN, # Use dedicated authorization parameter authorization=AUTH_TOKEN, # Use dedicated authorization parameter
) )
assert len(tools_list) == 2 assert len(tools_list) == 2

View file

@ -343,9 +343,11 @@ class TestAgentWithMCPTools:
mcp_endpoint=dict(uri=uri), mcp_endpoint=dict(uri=uri),
) )
# Use the dedicated authorization parameter # Phase 2: Use the dedicated authorization parameter
tools_list = llama_stack_client.tools.list( # Note: tools.list() is the ToolGroups API and doesn't have authorization parameter
toolgroup_id=test_toolgroup_id, # Use tool_runtime.list_tools() instead
tools_list = llama_stack_client.tool_runtime.list_tools(
tool_group_id=test_toolgroup_id,
authorization=AUTH_TOKEN, authorization=AUTH_TOKEN,
) )
tool_defs = [ tool_defs = [