Skip to content

Commit 18ca8b6

Browse files
committed
refactor(toolsets): remove unified API validation and support
Remove the unified API tool validation that was previously used to detect legacy/misconfigured accounts. This validation is no longer needed as the unified API architecture has been deprecated. Changes: - Remove UNIFIED_API_PREFIX constant from consts.ts - Remove validateToolName() method from StackOneToolSet class - Remove unified API tool validation call in fetchTools() - Remove UNIFIED_API_PREFIX import from toolsets.ts - Remove @see reference to unified-cloud-api in schema.ts - Remove corresponding unit test for unified API tool detection This simplifies the codebase by removing code paths that are no longer relevant to the current API architecture.
1 parent f9928a4 commit 18ca8b6

File tree

4 files changed

+1
-53
lines changed

4 files changed

+1
-53
lines changed

src/consts.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,3 @@ export const DEFAULT_BASE_URL = 'https://api.stackone.com';
1818
* - Higher values favor TF-IDF scoring (better semantic matching)
1919
*/
2020
export const DEFAULT_HYBRID_ALPHA = 0.2;
21-
22-
/**
23-
* Prefix used by legacy Unified API tools.
24-
* Tools with this prefix indicate missing or incorrect account configuration.
25-
*/
26-
export const UNIFIED_API_PREFIX = 'unified_';

src/schema.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const rpcActionResponseDataSchema = z.union([
3535
* - `next`: Pagination cursor for fetching next page
3636
*
3737
* Additional fields from the connector response are passed through.
38-
* @see unified-cloud-api/src/unified-api-v2/unifiedAPIv2.service.ts processActionCall
3938
*/
4039
export const rpcActionResponseSchema = z.looseObject({
4140
next: z.nullable(z.optional(z.string())),

src/toolsets.test.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -250,36 +250,6 @@ describe('StackOneToolSet', () => {
250250
const executableTool = (await tool?.toAISDK())?.dummy_action;
251251
expect(executableTool?.execute).toBeDefined();
252252
});
253-
254-
it('throws error when receiving unified API tools', async () => {
255-
const unifiedToolMcpApp = createMcpApp({
256-
accountTools: {
257-
'unified-test-account': [
258-
{
259-
name: 'unified_hris_list_employees',
260-
description: 'Unified HRIS tool',
261-
inputSchema: { type: 'object', properties: {} },
262-
},
263-
],
264-
},
265-
});
266-
267-
server.use(
268-
http.all('https://api.stackone-dev.com/mcp', async ({ request }) => {
269-
return unifiedToolMcpApp.fetch(request);
270-
}),
271-
);
272-
273-
const toolset = new StackOneToolSet({
274-
baseUrl: 'https://api.stackone-dev.com',
275-
apiKey: 'test-key',
276-
accountId: 'unified-test-account',
277-
});
278-
279-
await expect(toolset.fetchTools()).rejects.toThrow(ToolSetConfigError);
280-
await expect(toolset.fetchTools()).rejects.toThrow(/unified API tool/);
281-
await expect(toolset.fetchTools()).rejects.toThrow(/unified_hris_list_employees/);
282-
});
283253
});
284254

285255
describe('account filtering', () => {

src/toolsets.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defu } from 'defu';
22
import type { MergeExclusive, SimplifyDeep } from 'type-fest';
3-
import { DEFAULT_BASE_URL, UNIFIED_API_PREFIX } from './consts';
3+
import { DEFAULT_BASE_URL } from './consts';
44
import { createFeedbackTool } from './feedback';
55
import { type StackOneHeaders, normalizeHeaders, stackOneHeadersSchema } from './headers';
66
import { createMCPClient } from './mcp-client';
@@ -313,19 +313,6 @@ export class StackOneToolSet {
313313
return toolsWithFeedback;
314314
}
315315

316-
/**
317-
* Validate that tool name is not from unified API
318-
* Unified API tools indicate missing or incorrect account configuration
319-
*/
320-
private validateToolName(toolName: string): void {
321-
if (toolName.startsWith(UNIFIED_API_PREFIX)) {
322-
throw new ToolSetConfigError(
323-
`Received unified API tool "${toolName}". This indicates the account is not properly configured. ` +
324-
`Unified API tools require versioned connectors. Please check your account's integration setup.`,
325-
);
326-
}
327-
}
328-
329316
/**
330317
* Fetch tool definitions from MCP
331318
*/
@@ -344,8 +331,6 @@ export class StackOneToolSet {
344331
const actionsClient = this.getActionsClient();
345332

346333
const tools = listToolsResult.tools.map(({ name, description, inputSchema }) => {
347-
this.validateToolName(name);
348-
349334
return this.createRpcBackedTool({
350335
actionsClient,
351336
name,

0 commit comments

Comments
 (0)