Skip to content

Commit c365dbd

Browse files
authored
fix!: migrate examples and tests to connector-based tool naming (#51)
* refactor(examples): migrate to connector-based tool naming Replace legacy unified API naming conventions (hris_*, ats_*, crm_*) with connector-based naming (hibob_*, bamboohr_*, workday_*) across all example files. This aligns the examples with the updated StackOne API architecture where tools are named after the specific connector/provider rather than abstract unified API categories. Affected examples: - crewai_integration.py - file_uploads.py - index.py - langchain_integration.py - meta_tools_example.py - openai_integration.py - stackone_account_ids.py * refactor(tests): migrate to connector-based tool naming Update all test files to use connector-based naming conventions (hibob_*, bamboohr_*, workday_*) instead of legacy unified API naming (hris_*, ats_*, crm_*). This ensures tests remain consistent with the updated examples and reflect the actual tool naming used by StackOne connectors. Affected tests: - test_feedback.py - test_meta_tools.py - test_tfidf_index.py - test_toolset.py * docs(langgraph): update usage example to connector-based naming Update the docstring usage example in langgraph.py to use connector-based naming (hibob_*) and the current fetch_tools API instead of the deprecated get_tools method with unified API naming.
1 parent b2a3b70 commit c365dbd

File tree

12 files changed

+70
-70
lines changed

12 files changed

+70
-70
lines changed

examples/crewai_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
def crewai_integration():
2020
toolset = StackOneToolSet()
21-
tools = toolset.fetch_tools(actions=["hris_*"], account_ids=[account_id])
21+
tools = toolset.fetch_tools(actions=["bamboohr_*"], account_ids=[account_id])
2222

2323
# CrewAI uses LangChain tools natively
2424
langchain_tools = tools.to_langchain()

examples/file_uploads.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
Example demonstrating file upload functionality using StackOne.
3-
Shows how to upload an employee document using an HRIS integration.
3+
Shows how to upload an employee document using a BambooHR integration.
44
55
This example is runnable with the following command:
66
```bash
@@ -24,7 +24,7 @@
2424
"""
2525
# Resume content
2626
27-
This is a sample resume content that will be uploaded using the `hris_upload_employee_document` tool.
27+
This is a sample resume content that will be uploaded using the `bamboohr_upload_employee_document` tool.
2828
"""
2929

3030
resume_content = """
@@ -46,7 +46,7 @@
4646
"""
4747
# Upload employee document
4848
49-
This function uploads a resume using the `hris_upload_employee_document` tool.
49+
This function uploads a resume using the `bamboohr_upload_employee_document` tool.
5050
5151
"""
5252

@@ -57,9 +57,9 @@ def upload_employee_document() -> None:
5757
resume_file.write_text(resume_content)
5858

5959
toolset = StackOneToolSet()
60-
tools = toolset.fetch_tools(actions=["hris_*"], account_ids=[account_id])
60+
tools = toolset.fetch_tools(actions=["bamboohr_*"], account_ids=[account_id])
6161

62-
upload_tool = tools.get_tool("hris_upload_employee_document")
62+
upload_tool = tools.get_tool("bamboohr_upload_employee_document")
6363
assert upload_tool is not None
6464

6565
with open(resume_file, "rb") as f:

examples/index.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
StackOne AI SDK provides an AI-friendly interface for accessing various SaaS tools through the StackOne Unified API.
2+
StackOne AI SDK provides an AI-friendly interface for accessing various SaaS tools through the StackOne API.
33
44
This SDK is available on [PyPI](https://pypi.org/project/stackone-ai/) for python projects. There is a node version in the works.
55
@@ -72,11 +72,11 @@
7272
def quickstart():
7373
toolset = StackOneToolSet()
7474

75-
# Get all HRIS-related tools using MCP-backed fetch_tools()
76-
tools = toolset.fetch_tools(actions=["hris_*"], account_ids=[account_id])
75+
# Get all BambooHR-related tools using MCP-backed fetch_tools()
76+
tools = toolset.fetch_tools(actions=["bamboohr_*"], account_ids=[account_id])
7777

7878
# Use a specific tool
79-
employee_tool = tools.get_tool("hris_list_employees")
79+
employee_tool = tools.get_tool("bamboohr_list_employees")
8080
assert employee_tool is not None
8181

8282
employees = employee_tool.execute()

examples/langchain_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
def langchain_integration() -> None:
2121
toolset = StackOneToolSet()
22-
tools = toolset.fetch_tools(actions=["hris_*"], account_ids=[account_id])
22+
tools = toolset.fetch_tools(actions=["bamboohr_*"], account_ids=[account_id])
2323

2424
# Convert to LangChain format and verify
2525
langchain_tools = tools.to_langchain()

examples/meta_tools_example.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def example_meta_tools_basic():
2424
toolset = StackOneToolSet()
2525

2626
# Get all available tools using MCP-backed fetch_tools()
27-
all_tools = toolset.fetch_tools(actions=["hris_*"])
28-
print(f"Total HRIS tools available: {len(all_tools)}")
27+
all_tools = toolset.fetch_tools(actions=["bamboohr_*"])
28+
print(f"Total BambooHR tools available: {len(all_tools)}")
2929

3030
# Get meta tools for dynamic discovery
3131
meta_tools = all_tools.meta_tools()
@@ -93,9 +93,9 @@ def example_with_openai():
9393
# Initialize StackOne toolset
9494
toolset = StackOneToolSet()
9595

96-
# Get HRIS tools and their meta tools using MCP-backed fetch_tools()
97-
hris_tools = toolset.fetch_tools(actions=["hris_*"])
98-
meta_tools = hris_tools.meta_tools()
96+
# Get BambooHR tools and their meta tools using MCP-backed fetch_tools()
97+
bamboohr_tools = toolset.fetch_tools(actions=["bamboohr_*"])
98+
meta_tools = bamboohr_tools.meta_tools()
9999

100100
# Convert to OpenAI format
101101
openai_tools = meta_tools.to_openai()
@@ -142,7 +142,7 @@ def example_with_langchain():
142142
toolset = StackOneToolSet()
143143

144144
# Get tools and convert to LangChain format using MCP-backed fetch_tools()
145-
tools = toolset.fetch_tools(actions=["hris_list_*"])
145+
tools = toolset.fetch_tools(actions=["bamboohr_list_*"])
146146
langchain_tools = tools.to_langchain()
147147

148148
# Get meta tools as well

examples/openai_integration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ def openai_integration() -> None:
3636
# Filter tools to only the ones we need to avoid context window limits
3737
tools = toolset.fetch_tools(
3838
actions=[
39-
"hris_get_employee",
40-
"hris_list_employee_employments",
41-
"hris_get_employee_employment",
39+
"bamboohr_get_employee",
40+
"bamboohr_list_employee_employments",
41+
"bamboohr_get_employee_employment",
4242
],
4343
account_ids=[account_id],
4444
)

examples/stackone_account_ids.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ def stackone_account_ids():
1919
"""
2020
Set the account ID whilst getting tools using fetch_tools().
2121
"""
22-
tools = toolset.fetch_tools(actions=["hris_*"], account_ids=["test_id"])
22+
tools = toolset.fetch_tools(actions=["bamboohr_*"], account_ids=["test_id"])
2323

2424
"""
2525
You can override the account ID on fetched tools.
2626
"""
2727
tools.set_account_id("a_different_id")
2828

29-
employee_tool = tools.get_tool("hris_get_employee")
29+
employee_tool = tools.get_tool("bamboohr_get_employee")
3030
assert employee_tool is not None
3131

3232
"""

stackone_ai/integrations/langgraph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from stackone_ai.integrations.langgraph import to_tool_node
88
99
toolset = StackOneToolSet()
10-
tools = toolset.get_tools("hris_*", account_id="...")
10+
tools = toolset.fetch_tools(actions=["bamboohr_*"], account_ids=["..."])
1111
node = to_tool_node(tools) # langgraph.prebuilt.ToolNode
1212
"""
1313

tests/test_feedback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def test_live_feedback_submission() -> None:
252252
{
253253
"feedback": f"CI live test feedback {feedback_token}",
254254
"account_id": f"acc-ci-{feedback_token}",
255-
"tool_names": ["hris_list_employees"],
255+
"tool_names": ["hibob_list_employees"],
256256
}
257257
)
258258

tests/test_meta_tools.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ def sample_tools():
1717
"""Create sample tools for testing"""
1818
tools = []
1919

20-
# Create HRIS tools
20+
# Create HiBob tools
2121
for action in ["create", "list", "update", "delete"]:
2222
for entity in ["employee", "department", "timeoff"]:
23-
tool_name = f"hris_{action}_{entity}"
23+
tool_name = f"hibob_{action}_{entity}"
2424
execute_config = ExecuteConfig(
2525
name=tool_name,
2626
method="POST" if action in ["create", "update"] else "GET",
27-
url=f"https://api.example.com/hris/{entity}",
27+
url=f"https://api.example.com/hibob/{entity}",
2828
headers={},
2929
)
3030

@@ -37,21 +37,21 @@ def sample_tools():
3737
)
3838

3939
tool = StackOneTool(
40-
description=f"{action.capitalize()} {entity} in HRIS system",
40+
description=f"{action.capitalize()} {entity} in HiBob system",
4141
parameters=parameters,
4242
_execute_config=execute_config,
4343
_api_key="test_key",
4444
)
4545
tools.append(tool)
4646

47-
# Create ATS tools
47+
# Create BambooHR tools
4848
for action in ["create", "list", "search"]:
4949
for entity in ["candidate", "job", "application"]:
50-
tool_name = f"ats_{action}_{entity}"
50+
tool_name = f"bamboohr_{action}_{entity}"
5151
execute_config = ExecuteConfig(
5252
name=tool_name,
5353
method="POST" if action == "create" else "GET",
54-
url=f"https://api.example.com/ats/{entity}",
54+
url=f"https://api.example.com/bamboohr/{entity}",
5555
headers={},
5656
)
5757

@@ -64,7 +64,7 @@ def sample_tools():
6464
)
6565

6666
tool = StackOneTool(
67-
description=f"{action.capitalize()} {entity} in ATS system",
67+
description=f"{action.capitalize()} {entity} in BambooHR system",
6868
parameters=parameters,
6969
_execute_config=execute_config,
7070
_api_key="test_key",
@@ -217,13 +217,13 @@ def test_execute_tool_call(self, tools_collection):
217217
with responses.RequestsMock() as rsps:
218218
rsps.add(
219219
responses.GET,
220-
"https://api.example.com/hris/employee",
220+
"https://api.example.com/hibob/employee",
221221
json={"success": True, "employees": []},
222222
status=200,
223223
)
224224

225225
# Call the meta execute tool
226-
result = execute_tool.call(toolName="hris_list_employee", params={"limit": 10})
226+
result = execute_tool.call(toolName="hibob_list_employee", params={"limit": 10})
227227

228228
assert result is not None
229229
assert "success" in result or "employees" in result
@@ -288,14 +288,14 @@ def test_hybrid_search_returns_results(self, sample_tools):
288288
"""Test that hybrid search returns meaningful results"""
289289
index = ToolIndex(sample_tools, hybrid_alpha=0.2)
290290
# Use more specific query to ensure we get employee tools
291-
results = index.search("employee hris", limit=10)
291+
results = index.search("employee hibob", limit=10)
292292

293293
assert len(results) > 0
294-
# Should find HRIS employee tools - check in broader result set
294+
# Should find HiBob employee tools - check in broader result set
295295
result_names = [r.name for r in results]
296-
# At least one result should contain "employee" or "hris"
297-
assert any("employee" in name or "hris" in name for name in result_names), (
298-
f"Expected 'employee' or 'hris' in results: {result_names}"
296+
# At least one result should contain "employee" or "hibob"
297+
assert any("employee" in name or "hibob" in name for name in result_names), (
298+
f"Expected 'employee' or 'hibob' in results: {result_names}"
299299
)
300300

301301
def test_hybrid_search_with_different_alphas(self, sample_tools):

0 commit comments

Comments
 (0)