Skip to content

Conversation

@ryoppippi
Copy link
Member

@ryoppippi ryoppippi commented Dec 12, 2025

Summary

This PR removes the legacy Unified API integration and migrates all tool naming from category-based prefixes (hris_*, ats_*, crm_*) to integration-specific names (bamboohr_*, workday_*, salesforce_*).

What Changed

  • Removed unified API handlers: Deleted mocks/handlers.stackone-hris.ts and all unified endpoint mocks
  • Tool naming migration: Replaced category prefixes with actual integration provider names across:
    • All mock handlers
    • Test fixtures and assertions
    • Example code
    • README documentation
  • Simplified examples: Removed unnecessary tool filtering from single-account examples
  • Added validation: Reject unified API tools with clear error message
  • Documentation improvements: Added practical multi-account usage examples

Why

The unified API approach (unified_hris_list_employees) is legacy and doesn't align with StackOne's actual integration model where:

  • Each account links to a specific provider (BambooHR, Workday, etc.)
  • Tools are scoped to provider implementations, not abstract categories
  • Version information is tied to specific connectors

Integration-based naming (bamboohr_list_employees) makes:

  • Tool filtering more intuitive for end users
  • Account configuration requirements clearer
  • Multi-account scenarios easier to understand

Testing

All 304 tests pass including new validation test for unified API rejection.


Summary by cubic

Removed the legacy Unified API and switched tool/action names from category prefixes (hris_, ats_, crm_) to specific integration names (bamboohr_, workday_, salesforce_) for clarity and alignment with StackOne connectors. Added validation to reject unified_* tools and updated docs, examples, mocks, and tests.

  • Refactors

    • Removed unified API handlers and mocks (e.g., handlers.stackone-hris.ts).
    • Renamed tools/actions across codebase to integration-specific names.
    • Updated search/indexing to use “integration” instead of “category”.
    • Changed OAS mock server URL to the base API (removed /unified).
    • Added UNIFIED_API_PREFIX and validation to block unified_* tools.
  • Migration

    • Replace hris_, ats_, crm_* with bamboohr_, workday_, salesforce_* (e.g., hris_list_employees → bamboohr_list_employees).
    • Provide accountId for single-account usage; use integration globs for multi-account filtering (e.g., bamboohr_*).
    • Update RPC and test references to new action names.
    • If you see a unified_* tool error, fix the account’s connector/version configuration.
    • Adjust meta tool usage and examples to reference integration names.

Written for commit c7ca930. Summary will update automatically on new commits.

- Delete handlers.stackone-hris.ts containing unified HRIS endpoint mocks
- Remove stackoneHrisHandlers import and usage from handlers.ts
- Update OAS mock server URL from /unified to base URL

The unified API endpoints are no longer needed as integrations should
be referenced by their specific integration names rather than the
unified category prefix.
…fic names

Replace category prefixes (hris_, ats_, crm_) with actual integration
provider names (bamboohr_, workday_, salesforce_) across the entire
codebase. This change aligns tool naming with StackOne's integration
model where tools are scoped to specific provider implementations
rather than generic categories.

Changes:
- Update mock handlers to use bamboohr_*, workday_*, salesforce_*
- Rename all test fixtures and assertions
- Update examples to reference specific integrations
- Change tool.ts schema from 'category' to 'integration' field
- Update README documentation with integration-specific examples
- Modify tool discovery/search to use integration names

The integration-based naming better reflects the actual StackOne API
structure where each account links to a specific provider (e.g.,
BambooHR, Workday) rather than abstract categories. This makes tool
filtering and discovery more intuitive for end users.
…nt examples

Remove action filtering from single-account examples where it serves
no purpose. When using a single account ID, all returned tools are
already scoped to that account's integration, making action-based
filtering redundant.

Changes:
- Remove actions: ['bamboohr_*'] filter from basic examples
- Add accountId to toolset initialisation in README examples
- Simplify fetchTools() calls to no arguments for single-account cases
- Keep filtering in multi-account examples where it adds value

Filtering remains useful for:
- Multi-account scenarios (filter by provider or action type)
- Security/permission control (restrict to read-only operations)
- Demonstrated in fetch-tools.ts and meta-tools.ts examples
Add realistic multi-account example to demonstrate when tool filtering
is meaningful. Single-account usage doesn't need filtering since all
returned tools are already scoped to that account's integration.

Filtering becomes valuable when:
- Using multiple account IDs (e.g., BambooHR + Workday)
- Wanting to restrict to specific integration's tools
- Implementing permission/security controls

The updated example shows:
- Single account: simple fetchTools() with no filters
- Multiple accounts: returns tools from both integrations
- Multiple accounts with filter: restrict to one integration's tools
Add validation in fetchTools() to detect and reject unified API tools
which indicate improper account configuration. Extract unified API
prefix to a constant for maintainability.

Changes:
- Add UNIFIED_API_PREFIX constant to consts.ts
- Add validateToolName() method to check for unified_ prefix
- Throw ToolSetConfigError when unified API tools are detected
- Add test case verifying error is thrown for unified tools

Unified API tools (unified_*) are legacy and should not be used.
Their presence indicates the account lacks proper version configuration.
This validation helps users identify configuration issues early.
Copilot AI review requested due to automatic review settings December 12, 2025 10:17
@ryoppippi ryoppippi requested a review from a team as a code owner December 12, 2025 10:17
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 12, 2025

Open in StackBlitz

npm i https://pkg.pr.new/StackOneHQ/stackone-ai-node/@stackone/ai@219

commit: c7ca930

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 20 files

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="examples/openai-responses-integration.ts">

<violation number="1" location="examples/openai-responses-integration.ts:25">
P1: Mismatch between fetched tools and expected tool call: The filter `*_list_*` only fetches list operations, but the assertion expects `bamboohr_get_employee` (a get operation) which won&#39;t be available. Either change the filter to include get operations (e.g., `[&#39;*_list_*&#39;, &#39;*_get_*&#39;]`) or update the assertion to expect a list tool.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

// Fetch tools via MCP
const tools = await toolset.fetchTools({
actions: ['_list_*'],
actions: ['*_list_*'],
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Mismatch between fetched tools and expected tool call: The filter *_list_* only fetches list operations, but the assertion expects bamboohr_get_employee (a get operation) which won't be available. Either change the filter to include get operations (e.g., ['*_list_*', '*_get_*']) or update the assertion to expect a list tool.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At examples/openai-responses-integration.ts, line 25:

<comment>Mismatch between fetched tools and expected tool call: The filter `*_list_*` only fetches list operations, but the assertion expects `bamboohr_get_employee` (a get operation) which won&#39;t be available. Either change the filter to include get operations (e.g., `[&#39;*_list_*&#39;, &#39;*_get_*&#39;]`) or update the assertion to expect a list tool.</comment>

<file context>
@@ -20,9 +20,9 @@ const openaiResponsesIntegration = async (): Promise&lt;void&gt; =&gt; {
+	// Fetch tools via MCP
 	const tools = await toolset.fetchTools({
-		actions: [&#39;_list_*&#39;],
+		actions: [&#39;*_list_*&#39;],
 	});
 	const openAIResponsesTools = tools.toOpenAIResponses();
</file context>
Suggested change
actions: ['*_list_*'],
actions: ['*_list_*', '*_get_*'],
Fix with Cubic

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the legacy Unified API integration and migrates the codebase from category-based tool naming (e.g., hris_*, ats_*, crm_*) to integration-specific naming (e.g., bamboohr_*, workday_*, salesforce_*). This aligns the naming convention with StackOne's actual integration model where each account is linked to a specific provider.

Key changes:

  • Added validation to reject unified API tools with clear error messaging
  • Updated all tool references across tests, mocks, examples, and documentation
  • Removed the legacy unified HRIS handler and related mock endpoints

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/consts.ts Added UNIFIED_API_PREFIX constant to identify legacy unified API tools
src/toolsets.ts Implemented validateToolName method to reject unified API tools during fetch
src/toolsets.test.ts Added comprehensive test coverage for unified API validation; updated glob pattern tests with integration-specific names
src/tool.ts Renamed category variable to integration throughout for clarity and accuracy
src/tool.test.ts Updated all mock tools and test assertions from category-based to integration-specific names
src/utils/tfidf-index.test.ts Updated test fixtures to use integration-specific tool names
src/rpc-client.test.ts Updated RPC action test examples to use integration-specific names
mocks/handlers.ts Removed import and reference to deleted stackoneHrisHandlers
mocks/handlers.stackone-hris.ts Deleted entire file containing legacy unified HRIS endpoint handlers
mocks/handlers.stackone-rpc.ts Updated mock RPC handlers to use integration-specific action names
mocks/handlers.stackone-ai.ts Updated AI handler mocks with integration-specific tool names and adjusted server URL
mocks/handlers.openai.ts Updated OpenAI mock handlers to return integration-specific tool calls
examples/index.ts Simplified quickstart to fetch all account tools; updated tool name references
examples/openai-integration.ts Removed unnecessary filtering; updated account ID placeholder and assertions
examples/openai-responses-integration.ts Updated account ID placeholder, tool name assertions, and filter pattern
examples/ai-sdk-integration.ts Removed unnecessary filtering; updated account ID placeholder
examples/fetch-tools.ts Updated tool name examples to use integration-specific names
examples/meta-tools.ts Updated all account ID placeholders, tool filters, and tool name references to integration-specific naming
examples/planning.ts Updated account ID variable names and values; changed tool filters to integration-specific patterns
README.md Added accountId to examples; updated system prompt references; improved multi-account usage documentation with practical examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@glebedel glebedel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please double check that the actions in the example actually exist for Bamboohr (not sure if it was just a replace of hris_ or if you took a real action name)

@ryoppippi ryoppippi changed the title refactor: remove unified API integration and migrate to connector-based naming fix!: remove unified API integration and migrate to connector-based naming Dec 12, 2025
Resolve conflicts:
- Remove examples/planning.ts (deleted in main)
- Accept upstream changes to examples/README.md
- Accept upstream changes to lefthook.yaml
- Merge src/toolsets.ts changes
@ryoppippi ryoppippi merged commit 79e0bc2 into main Dec 12, 2025
9 checks passed
@ryoppippi ryoppippi deleted the refactor/remove-unified-api-integration branch December 12, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants