mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
fix: Update MCP test to use register() instead of register_tool_group()
The Stainless-generated SDK now uses register() and unregister() methods instead of register_tool_group() and unregister_toolgroup(). Updated the test to use the correct method names that match the latest SDK.
This commit is contained in:
parent
eddd29a91e
commit
50cae44dd0
1 changed files with 2 additions and 6 deletions
|
|
@ -179,19 +179,15 @@ class TestMCPToolsInChatCompletion:
|
||||||
if not isinstance(llama_stack_client, LlamaStackAsLibraryClient):
|
if not isinstance(llama_stack_client, LlamaStackAsLibraryClient):
|
||||||
pytest.skip("Library client required for local MCP server")
|
pytest.skip("Library client required for local MCP server")
|
||||||
|
|
||||||
# Check if the client has the register_tool_group method (older client versions)
|
|
||||||
if not hasattr(llama_stack_client.toolgroups, 'register_tool_group'):
|
|
||||||
pytest.skip("Client SDK doesn't support dynamic toolgroup registration - toolgroups must be configured in run.yaml")
|
|
||||||
|
|
||||||
test_toolgroup_id = "mcp::calc"
|
test_toolgroup_id = "mcp::calc"
|
||||||
uri = mcp_with_schemas["server_url"]
|
uri = mcp_with_schemas["server_url"]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
llama_stack_client.toolgroups.unregister_toolgroup(toolgroup_id=test_toolgroup_id)
|
llama_stack_client.toolgroups.unregister(toolgroup_id=test_toolgroup_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
llama_stack_client.toolgroups.register_tool_group(
|
llama_stack_client.toolgroups.register(
|
||||||
toolgroup_id=test_toolgroup_id,
|
toolgroup_id=test_toolgroup_id,
|
||||||
provider_id="model-context-protocol",
|
provider_id="model-context-protocol",
|
||||||
mcp_endpoint=dict(uri=uri),
|
mcp_endpoint=dict(uri=uri),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue