chore: refined tool types and eslint config#58
chore: refined tool types and eslint config#58Patrik Simek (patriksimek) merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refines the SDK’s tool typing and schema definitions, updates multiple endpoint tool modules to explicitly type their exported tools arrays, and adjusts linting/test configuration to better cover Jest spec files.
Changes:
- Expanded
JSONSchematyping (e.g.,patternProperties) and tightened several endpoint response/value types toJSONValue. - Standardized many endpoint
*.tools.tsexports toexport const tools: MakeTool[] = [...]and updated a few tool metadata fields (scopeId/identifier/resourceId) and schemas (oneOf). - Updated Jest/ESLint config to include
*.spec.tsand bumped package version to1.4.0.
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/mcp.spec.ts | Refactors validations (scope checks, duplicate names reporting) and expands naming convention assertions. |
| src/tools.ts | Extends JSONSchema and adjusts the MakeTool.execute type/signature contract. |
| src/endpoints/users.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/teams.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/sdk/webhooks.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/sdk/rpcs.ts | Tightens test() return type to JSONValue. |
| src/endpoints/sdk/rpcs.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/sdk/modules.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/sdk/functions.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/sdk/connections.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/sdk/apps.ts | Refines SDKApp.changes element type to JSON-shaped records. |
| src/endpoints/sdk/apps.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/scenarios.ts | Refines scenario fields (customProperties, outputs) to JSONValue-based types. |
| src/endpoints/scenarios.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/public-templates.tools.ts | Adjusts tool metadata fields (scopeId/identifier) and resource targeting. |
| src/endpoints/organizations.ts | Refines features to Record<string, JSONValue> and updates imports. |
| src/endpoints/organizations.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/keys.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/incomplete-executions.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/hooks.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/functions.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/folders.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/executions.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/enums.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/devices.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/data-structures.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/data-stores.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/data-store-records.tools.ts | Types exported tools as MakeTool[]. |
| src/endpoints/credential-requests.tools.ts | Types exported tools as MakeTool[], refines schema union typing (oneOf), and adjusts id fields. |
| src/endpoints/connections.tools.ts | Types exported tools as MakeTool[]. |
| package.json | Bumps package version to 1.4.0. |
| package-lock.json | Updates lockfile package version to 1.4.0. |
| eslint.config.mjs | Enables Jest lint rules for *.spec.ts in addition to *.test.ts. |
Comments suppressed due to low confidence (1)
src/endpoints/sdk/rpcs.ts:155
FetchFunctiondefaults its generic tounknown, so callingthis.#fetch(...)without a type argument returnsPromise<unknown>, which won’t satisfy the newPromise<JSONValue>return type. Pass a type parameter (e.g.this.#fetch<JSONValue>(...)) or cast the result toJSONValueso this compiles understricttyping.
async test(appName: string, appVersion: number, rpcName: string, body: TestSDKRPCBody): Promise<JSONValue> {
return await this.#fetch(`/sdk/apps/${appName}/${appVersion}/rpcs/${rpcName}`, {
method: 'POST',
body,
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // SDK categories should start with "sdk." | ||
| MakeTools.filter(tool => tool.name.startsWith('sdk_')).forEach(tool => { | ||
| expect(tool.category).toMatch(/^sdk\./); | ||
| }); |
There was a problem hiding this comment.
The SDK-category assertion here is both mismatched with the current SDK tool naming and currently ineffective: SDK tool names use the sdk- prefix (e.g. sdk-apps_list), so filtering by name.startsWith('sdk_') yields an empty set, and the ^sdk\. expectation doesn’t match existing categories like sdk-apps. Consider filtering by tool.category.startsWith('sdk-') (or tool.name.startsWith('sdk-')) and asserting the sdk- prefix, or update the actual categories to sdk.* consistently if that’s the intended convention.
| */ | ||
| execute: (make: Make, args?: Record<string, JSONValue>) => Promise<JSONValue>; | ||
| execute(make: Make, args: Record<string, JSONValue>): Promise<JSONValue>; | ||
| }; |
There was a problem hiding this comment.
Changing MakeTool.execute to require args is a breaking API change for any tool runner that previously called execute(make) for tools with empty inputSchema (and it forces callers to always pass an object even when no args exist). If backward compatibility is desired, consider keeping args optional (or giving it a default {}) while still allowing tools with required inputs to enforce required keys via their own arg types.
| category: 'public-templates', | ||
| scope: 'templates:read', | ||
| scopeId: undefined, | ||
| identifier: undefined, | ||
| annotations: { |
There was a problem hiding this comment.
This file is now being updated, but unlike the other *.tools.ts modules it still exports an untyped tools array (no MakeTool[] annotation). That makes it easier for tool objects here to drift from the MakeTool contract without TypeScript catching it. Consider importing MakeTool and declaring export const tools: MakeTool[] = [...] for consistency with the rest of src/endpoints/*/*.tools.ts.
Tightens types across the harness-agnostic tool definitions and irons out a few small ESLint / test issues that fell out of recent refactors.