Skip to content

Commit 960b3af

Browse files
authored
fix slack mcp (#629)
1 parent 72d6f3a commit 960b3af

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

tests/functional/agent/agent_functional_test.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_end2end(run_input_map, delete_agents_and_team_agents, AgentFactory):
9898
assert response["completed"] is True
9999
assert response["status"].lower() == "success"
100100
assert "data" in response
101-
assert response["data"]["session_id"] is not None
101+
assert response["data"]["session_id"] is None
102102
assert response["data"]["output"] is not None
103103
agent.delete()
104104

@@ -520,7 +520,7 @@ def test_instructions(delete_agents_and_team_agents, AgentFactory):
520520
assert response["completed"] is True
521521
assert response["status"].lower() == "success"
522522
assert "data" in response
523-
assert response["data"]["session_id"] is not None
523+
assert response["data"]["session_id"] is None
524524
assert response["data"]["output"] is not None
525525
assert "aixplain" in response["data"]["output"].lower()
526526
agent.delete()
@@ -734,11 +734,15 @@ def test_agent_with_action_tool():
734734

735735
connector = ModelFactory.get("686432941223092cb4294d3f")
736736
# connect
737-
response = connector.connect(authentication_schema=AuthenticationSchema.BEARER_TOKEN, data={"token": os.getenv("SLACK_TOKEN")})
737+
response = connector.connect(
738+
authentication_schema=AuthenticationSchema.BEARER_TOKEN, data={"token": os.getenv("SLACK_TOKEN")}
739+
)
738740
connection_id = response.data["id"]
739741

740742
connection = ModelFactory.get(connection_id)
741-
connection.action_scope = [action for action in connection.actions if action.code == "SLACK_SENDS_A_MESSAGE_TO_A_SLACK_CHANNEL"]
743+
connection.action_scope = [
744+
action for action in connection.actions if action.code == "SLACK_SENDS_A_MESSAGE_TO_A_SLACK_CHANNEL"
745+
]
742746

743747
agent = AgentFactory.create(
744748
name="Test Agent",
@@ -757,15 +761,22 @@ def test_agent_with_action_tool():
757761
assert response is not None
758762
assert response["status"].lower() == "success"
759763
assert "helsinki" in response.data.output.lower()
760-
assert "SLACK_SENDS_A_MESSAGE_TO_A_SLACK_CHANNEL" in [step["tool"] for step in response.data.intermediate_steps[0]["tool_steps"]]
764+
assert "SLACK_SENDS_A_MESSAGE_TO_A_SLACK_CHANNEL" in [
765+
step["tool"] for step in response.data.intermediate_steps[0]["tool_steps"]
766+
]
761767
connection.delete()
762768

763769

764770
def test_agent_with_mcp_tool():
765-
connector = ModelFactory.get("68549a33ba00e44f357896f1")
771+
from aixplain.modules.model.integration import AuthenticationSchema
772+
773+
connector = ModelFactory.get("686eb9cd26480723d0634d3e")
766774
# connect
767775
response = connector.connect(
768-
data="https://mcp.zapier.com/api/mcp/s/OTJiMjVlYjEtMGE4YS00OTVjLWIwMGYtZDJjOGVkNTc4NjFkOjI0MTNjNzg5LWZlNGMtNDZmNC05MDhmLWM0MGRlNDU4ZmU1NA==/mcp"
776+
authentication_schema=AuthenticationSchema.API_KEY,
777+
data={
778+
"url": "https://mcp.zapier.com/api/mcp/s/OTJiMjVlYjEtMGE4YS00OTVjLWIwMGYtZDJjOGVkNTc4NjFkOjI0MTNjNzg5LWZlNGMtNDZmNC05MDhmLWM0MGRlNDU4ZmU1NA==/mcp"
779+
},
769780
)
770781
connection_id = response.data["id"]
771782
connection = ModelFactory.get(connection_id)

tests/functional/team_agent/team_agent_functional_test.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def test_end2end(run_input_map, delete_agents_and_team_agents, TeamAgentFactory)
8282
assert response["completed"] is True
8383
assert response["status"].lower() == "success"
8484
assert "data" in response
85-
assert response["data"]["session_id"] is not None
85+
assert response["data"]["session_id"] is None
8686
assert response["data"]["output"] is not None
8787

8888
team_agent.delete()
@@ -447,11 +447,15 @@ def test_team_agent_with_slack_connector():
447447

448448
connector = ModelFactory.get("686432941223092cb4294d3f")
449449
# connect
450-
response = connector.connect(authentication_schema=AuthenticationSchema.BEARER_TOKEN, data={"token": os.getenv("SLACK_TOKEN")})
450+
response = connector.connect(
451+
authentication_schema=AuthenticationSchema.BEARER_TOKEN, data={"token": os.getenv("SLACK_TOKEN")}
452+
)
451453
connection_id = response.data["id"]
452454

453455
connection = ModelFactory.get(connection_id)
454-
connection.action_scope = [action for action in connection.actions if action.code == "SLACK_SENDS_A_MESSAGE_TO_A_SLACK_CHANNEL"]
456+
connection.action_scope = [
457+
action for action in connection.actions if action.code == "SLACK_SENDS_A_MESSAGE_TO_A_SLACK_CHANNEL"
458+
]
455459

456460
agent = AgentFactory.create(
457461
name="Test Agent",

0 commit comments

Comments
 (0)