diff --git a/eslint.config.mjs b/eslint.config.mjs index 890dab2..e9f927b 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -33,7 +33,7 @@ export default tseslint.config( }, { // enable jest rules on test files - files: ['**/*.test.ts'], + files: ['**/*.test.ts', '**/*.spec.ts'], extends: [jestPlugin.configs['flat/recommended']], rules: { 'jest/no-standalone-expect': ['error', { additionalTestBlockFunctions: ['itif'] }], diff --git a/package-lock.json b/package-lock.json index 24fe0a4..567cfcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@makehq/sdk", - "version": "1.3.0", + "version": "1.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@makehq/sdk", - "version": "1.3.0", + "version": "1.4.0", "license": "MIT", "devDependencies": { "@eslint/js": "^9.22.0", diff --git a/package.json b/package.json index bfb5971..e5827af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@makehq/sdk", - "version": "1.3.0", + "version": "1.4.0", "description": "Make TypeScript SDK", "license": "MIT", "author": "Make", diff --git a/src/endpoints/connections.tools.ts b/src/endpoints/connections.tools.ts index d1c0a85..de1e2bf 100644 --- a/src/endpoints/connections.tools.ts +++ b/src/endpoints/connections.tools.ts @@ -1,7 +1,8 @@ import type { Make } from '../make.js'; import type { JSONValue } from '../types.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'connections_list', title: 'List connections', diff --git a/src/endpoints/credential-requests.tools.ts b/src/endpoints/credential-requests.tools.ts index f52cd5c..9f0a6d4 100644 --- a/src/endpoints/credential-requests.tools.ts +++ b/src/endpoints/credential-requests.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../make.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'credential-requests_list', title: 'List credential requests', @@ -19,7 +20,7 @@ export const tools = [ teamId: { type: 'number', description: 'Filter by team ID' }, userId: { type: 'number', description: 'Filter by user ID' }, makeProviderId: { - type: ['string', 'number'], + oneOf: [{ type: 'string' }, { type: 'number' }], description: 'Filter by Make provider ID', }, status: { type: 'string', description: 'Filter by status' }, @@ -465,8 +466,9 @@ export const tools = [ 'For custom/SDK apps, prefix the app name with `app#` (e.g. `app#my-custom-app`).', category: 'credential-requests', scope: 'apps:read', - scopeId: 'appName', - identifier: 'appName', + scopeId: undefined, + identifier: undefined, + resourceId: 'appName', annotations: { readOnlyHint: true, }, diff --git a/src/endpoints/data-store-records.tools.ts b/src/endpoints/data-store-records.tools.ts index 2fd8cea..890ae88 100644 --- a/src/endpoints/data-store-records.tools.ts +++ b/src/endpoints/data-store-records.tools.ts @@ -1,7 +1,8 @@ import type { Make } from '../make.js'; import type { JSONValue } from '../types.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'data-store-records_list', title: 'List data store records', diff --git a/src/endpoints/data-stores.tools.ts b/src/endpoints/data-stores.tools.ts index aee92bf..51c7da1 100644 --- a/src/endpoints/data-stores.tools.ts +++ b/src/endpoints/data-stores.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../make.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'data-stores_list', title: 'List data stores', diff --git a/src/endpoints/data-structures.tools.ts b/src/endpoints/data-structures.tools.ts index a760fcf..2ef459e 100644 --- a/src/endpoints/data-structures.tools.ts +++ b/src/endpoints/data-structures.tools.ts @@ -1,7 +1,8 @@ import type { Make } from '../make.js'; import type { DataStructureField } from './data-structures.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'data-structures_list', title: 'List data structures', diff --git a/src/endpoints/devices.tools.ts b/src/endpoints/devices.tools.ts index 5b2e80d..6a11ec6 100644 --- a/src/endpoints/devices.tools.ts +++ b/src/endpoints/devices.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../make.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'devices_list', title: 'List devices', diff --git a/src/endpoints/enums.tools.ts b/src/endpoints/enums.tools.ts index 3d0acdc..4660599 100644 --- a/src/endpoints/enums.tools.ts +++ b/src/endpoints/enums.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../make.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'enums_countries', title: 'List countries', diff --git a/src/endpoints/executions.tools.ts b/src/endpoints/executions.tools.ts index e359ef4..8760bd0 100644 --- a/src/endpoints/executions.tools.ts +++ b/src/endpoints/executions.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../make.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'executions_list', title: 'List executions', diff --git a/src/endpoints/folders.tools.ts b/src/endpoints/folders.tools.ts index 3c90147..212d3cb 100644 --- a/src/endpoints/folders.tools.ts +++ b/src/endpoints/folders.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../make.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'folders_list', title: 'List folders', diff --git a/src/endpoints/functions.tools.ts b/src/endpoints/functions.tools.ts index fb342f0..7c7cbc9 100644 --- a/src/endpoints/functions.tools.ts +++ b/src/endpoints/functions.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../make.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'functions_list', title: 'List functions', diff --git a/src/endpoints/hooks.tools.ts b/src/endpoints/hooks.tools.ts index 80fa4c0..f987970 100644 --- a/src/endpoints/hooks.tools.ts +++ b/src/endpoints/hooks.tools.ts @@ -1,7 +1,8 @@ import type { Make } from '../make.js'; import type { JSONValue } from '../types.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'hooks_list', title: 'List webhooks/mailhooks', diff --git a/src/endpoints/incomplete-executions.tools.ts b/src/endpoints/incomplete-executions.tools.ts index 63dbb4e..336e3f5 100644 --- a/src/endpoints/incomplete-executions.tools.ts +++ b/src/endpoints/incomplete-executions.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../make.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'incomplete-executions_list', title: 'List incomplete executions', diff --git a/src/endpoints/keys.tools.ts b/src/endpoints/keys.tools.ts index 7da25cf..5c27737 100644 --- a/src/endpoints/keys.tools.ts +++ b/src/endpoints/keys.tools.ts @@ -1,7 +1,8 @@ import type { Make } from '../make.js'; import type { JSONValue } from '../types.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'keys_list', title: 'List keys', diff --git a/src/endpoints/organizations.tools.ts b/src/endpoints/organizations.tools.ts index b4a3552..1486811 100644 --- a/src/endpoints/organizations.tools.ts +++ b/src/endpoints/organizations.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../make.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'organizations_list', title: 'List organizations', diff --git a/src/endpoints/organizations.ts b/src/endpoints/organizations.ts index 112e2f8..ee19eae 100644 --- a/src/endpoints/organizations.ts +++ b/src/endpoints/organizations.ts @@ -1,4 +1,4 @@ -import type { FetchFunction, Pagination, PickColumns } from '../types.js'; +import type { FetchFunction, JSONValue, Pagination, PickColumns } from '../types.js'; /** * Represents an organization in Make. @@ -131,7 +131,7 @@ export type Organization = { /** Unused transfer */ unusedTransfer: string; /** Organization features */ - features: Record; + features: Record; /** External ID for white label instances */ externalId: string; /** Number of active apps */ diff --git a/src/endpoints/public-templates.tools.ts b/src/endpoints/public-templates.tools.ts index 4e06fc2..4109c23 100644 --- a/src/endpoints/public-templates.tools.ts +++ b/src/endpoints/public-templates.tools.ts @@ -8,6 +8,8 @@ export const tools = [ 'Search and list public (approved) templates available for anyone. Supports name-based search for template discovery. Results are sorted by usage by default.', category: 'public-templates', scope: 'templates:read', + scopeId: undefined, + identifier: undefined, annotations: { readOnlyHint: true, }, @@ -38,8 +40,8 @@ export const tools = [ 'Get details of a public template by its URL slug (e.g. "12289-add-webhook-data-to-a-google-sheet"). Use this for templates discovered via public-templates_list.', category: 'public-templates', scope: 'templates:read', - scopeId: 'templateUrl', - identifier: 'templateUrl', + scopeId: undefined, + identifier: undefined, resourceId: 'templateUrl', annotations: { readOnlyHint: true, @@ -67,8 +69,8 @@ export const tools = [ 'Get the full blueprint of a public template including scenario flow, controller configuration, scheduling, and metadata. Use this for templates discovered via public-templates_list.', category: 'public-templates', scope: 'templates:read', - scopeId: 'templateUrl', - identifier: 'templateUrl', + scopeId: undefined, + identifier: undefined, resourceId: 'templateUrl', annotations: { readOnlyHint: true, diff --git a/src/endpoints/scenarios.tools.ts b/src/endpoints/scenarios.tools.ts index 100c509..ae84311 100644 --- a/src/endpoints/scenarios.tools.ts +++ b/src/endpoints/scenarios.tools.ts @@ -2,8 +2,9 @@ import type { Blueprint, DataStructureField } from '../index.js'; import type { Make } from '../make.js'; import type { JSONValue } from '../types.js'; import type { Scheduling } from './scenarios.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'scenarios_list', title: 'List scenarios', diff --git a/src/endpoints/scenarios.ts b/src/endpoints/scenarios.ts index c521ca9..360b03d 100644 --- a/src/endpoints/scenarios.ts +++ b/src/endpoints/scenarios.ts @@ -58,7 +58,7 @@ export type Scenario = { /** Data transfer consumed in the current period */ transfer: number; /** Custom properties defined for the scenario */ - customProperties?: Record; + customProperties?: Record; }; export type Scheduling = { @@ -168,7 +168,7 @@ export type RunScenarioResponse = { /** Status of the scenario execution when run in responsive mode (1 = successful, 2 = successful with warnings, 3 = failed) */ status?: 1 | 2 | 3; /** Output data from the scenario execution (when run in responsive mode) */ - outputs: unknown; + outputs?: JSONValue; }; /** diff --git a/src/endpoints/sdk/apps.tools.ts b/src/endpoints/sdk/apps.tools.ts index 0328617..26597ad 100644 --- a/src/endpoints/sdk/apps.tools.ts +++ b/src/endpoints/sdk/apps.tools.ts @@ -1,7 +1,8 @@ import type { Make } from '../../make.js'; import type { JSONValue } from '../../types.js'; +import type { MakeTool } from '../../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'sdk-apps_list', title: 'List SDK apps', diff --git a/src/endpoints/sdk/apps.ts b/src/endpoints/sdk/apps.ts index 5eb28f4..a115416 100644 --- a/src/endpoints/sdk/apps.ts +++ b/src/endpoints/sdk/apps.ts @@ -32,7 +32,7 @@ export type SDKApp = { /** The manifest version */ manifestVersion: number; /** Stack of changes made to the app */ - changes?: unknown[]; + changes?: Record[]; }; /** diff --git a/src/endpoints/sdk/connections.tools.ts b/src/endpoints/sdk/connections.tools.ts index 572b120..06cac15 100644 --- a/src/endpoints/sdk/connections.tools.ts +++ b/src/endpoints/sdk/connections.tools.ts @@ -1,7 +1,8 @@ import type { Make } from '../../make.js'; import type { JSONValue } from '../../types.js'; +import type { MakeTool } from '../../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'sdk-connections_list', title: 'List SDK connections', diff --git a/src/endpoints/sdk/functions.tools.ts b/src/endpoints/sdk/functions.tools.ts index 39a4c20..9006dd5 100644 --- a/src/endpoints/sdk/functions.tools.ts +++ b/src/endpoints/sdk/functions.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../../make.js'; +import type { MakeTool } from '../../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'sdk-functions_list', title: 'List SDK functions', diff --git a/src/endpoints/sdk/modules.tools.ts b/src/endpoints/sdk/modules.tools.ts index ad6b6fd..ce14191 100644 --- a/src/endpoints/sdk/modules.tools.ts +++ b/src/endpoints/sdk/modules.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../../make.js'; +import type { MakeTool } from '../../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'sdk-modules_list', title: 'List SDK modules', diff --git a/src/endpoints/sdk/rpcs.tools.ts b/src/endpoints/sdk/rpcs.tools.ts index 79c0458..0d7b998 100644 --- a/src/endpoints/sdk/rpcs.tools.ts +++ b/src/endpoints/sdk/rpcs.tools.ts @@ -1,7 +1,8 @@ import type { Make } from '../../make.js'; import type { JSONValue } from '../../types.js'; +import type { MakeTool } from '../../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'sdk-rpcs_list', title: 'List SDK RPCs', diff --git a/src/endpoints/sdk/rpcs.ts b/src/endpoints/sdk/rpcs.ts index 336a5e5..4087e68 100644 --- a/src/endpoints/sdk/rpcs.ts +++ b/src/endpoints/sdk/rpcs.ts @@ -148,7 +148,7 @@ export class SDKRPCs { * Test an RPC with provided data and schema * @returns The test result */ - async test(appName: string, appVersion: number, rpcName: string, body: TestSDKRPCBody): Promise { + async test(appName: string, appVersion: number, rpcName: string, body: TestSDKRPCBody): Promise { return await this.#fetch(`/sdk/apps/${appName}/${appVersion}/rpcs/${rpcName}`, { method: 'POST', body, diff --git a/src/endpoints/sdk/webhooks.tools.ts b/src/endpoints/sdk/webhooks.tools.ts index d5457ad..d2976e1 100644 --- a/src/endpoints/sdk/webhooks.tools.ts +++ b/src/endpoints/sdk/webhooks.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../../make.js'; +import type { MakeTool } from '../../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'sdk-webhooks_list', title: 'List SDK webhooks', diff --git a/src/endpoints/teams.tools.ts b/src/endpoints/teams.tools.ts index 2105695..c89f850 100644 --- a/src/endpoints/teams.tools.ts +++ b/src/endpoints/teams.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../make.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'teams_list', title: 'List teams', diff --git a/src/endpoints/users.tools.ts b/src/endpoints/users.tools.ts index 043d91b..fa4549d 100644 --- a/src/endpoints/users.tools.ts +++ b/src/endpoints/users.tools.ts @@ -1,6 +1,7 @@ import type { Make } from '../make.js'; +import type { MakeTool } from '../tools.js'; -export const tools = [ +export const tools: MakeTool[] = [ { name: 'users_me', title: 'Get current user', diff --git a/src/tools.ts b/src/tools.ts index 39d6926..01ad724 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -39,6 +39,8 @@ export type JSONSchema = { type?: 'object' | 'string' | 'number' | 'boolean' | 'array' | 'null'; /** Properties definition for object types */ properties?: Record; + /** Schemas for properties whose names match a regex pattern (object types) */ + patternProperties?: Record; /** Required property names for object types */ required?: string[]; /** Items schema for array types */ @@ -177,7 +179,7 @@ export type MakeTool = { * @param args The input arguments matching the inputSchema * @returns Promise resolving to the operation result */ - execute: (make: Make, args?: Record) => Promise; + execute(make: Make, args: Record): Promise; }; /** diff --git a/test/mcp.spec.ts b/test/mcp.spec.ts index b4d146c..c7db570 100644 --- a/test/mcp.spec.ts +++ b/test/mcp.spec.ts @@ -37,12 +37,12 @@ describe('MCP Tools', () => { expect(tool.title.length).toBeGreaterThan(0); expect(tool.description.length).toBeGreaterThan(0); expect(tool.category.length).toBeGreaterThan(0); + }); - // Scope is optional, but if present should be a string - if (tool.scope !== undefined) { - expect(typeof tool.scope).toBe('string'); - expect(tool.scope.length).toBeGreaterThan(0); - } + // Scope is optional, but if present should be a non-empty string + MakeTools.filter(tool => tool.scope !== undefined).forEach(tool => { + expect(typeof tool.scope).toBe('string'); + expect(tool.scope!.length).toBeGreaterThan(0); }); }); @@ -64,7 +64,7 @@ describe('MCP Tools', () => { seen.add(name); }); - fail(`Duplicate tool names found: ${duplicates.join(', ')}`); + throw new Error(`Duplicate tool names found: ${duplicates.join(', ')}`); } }); @@ -103,11 +103,11 @@ describe('MCP Tools', () => { // Categories should use dot notation for hierarchy const categoryPattern = /^[a-z][a-z.-]*[a-z]$/; expect(tool.category).toMatch(categoryPattern); + }); - // SDK categories should start with "sdk." - if (tool.name.startsWith('sdk_')) { - expect(tool.category).toMatch(/^sdk\./); - } + // SDK categories should start with "sdk." + MakeTools.filter(tool => tool.name.startsWith('sdk_')).forEach(tool => { + expect(tool.category).toMatch(/^sdk\./); }); });