refactor(tools): harness-agnostic tool definitions#57
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the SDK’s tool metadata into a harness-agnostic MakeTool / MakeTools shape so the same tool definitions can be consumed by MCP, the CLI, and future integrations without duplicate adapters.
Changes:
- Introduces
src/tools.tsas the canonical tool-definition aggregator (MakeTool,MakeTools) and adds the new@makehq/sdk/toolsexport subpath. - Keeps MCP compatibility via deprecated aliases in
src/mcp.ts(MakeMCPTool,MakeMCPTools) that point to the canonical definitions. - Adds
scopeId/resourceIdmetadata across endpoint tool definitions and enforces invariants via expanded Jest coverage.
Reviewed changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tsup.config.ts | Adds src/tools.ts as a build entrypoint so dist/tools.* is published. |
| test/mcp.spec.ts | Switches tests to MakeTools and adds invariants for scopeId / resourceId / identifier. |
| src/tools.ts | New canonical tool types and aggregated MakeTools list. |
| src/mcp.ts | Converts MCP exports into deprecated aliases backed by ./tools. |
| src/endpoints/users.tools.ts | Adds scopeId metadata (explicitly undefined) for consistency with invariants. |
| src/endpoints/teams.tools.ts | Adds scopeId / resourceId to team tools. |
| src/endpoints/sdk/webhooks.tools.ts | Adds scopeId metadata (explicitly undefined) for SDK tools. |
| src/endpoints/sdk/rpcs.tools.ts | Adds scopeId metadata (explicitly undefined) for SDK tools. |
| src/endpoints/sdk/modules.tools.ts | Adds scopeId metadata (explicitly undefined) for SDK tools. |
| src/endpoints/sdk/functions.tools.ts | Adds scopeId metadata (explicitly undefined) for SDK tools. |
| src/endpoints/sdk/connections.tools.ts | Adds scopeId metadata (explicitly undefined) for SDK tools. |
| src/endpoints/sdk/apps.tools.ts | Adds scopeId metadata (explicitly undefined) for SDK tools. |
| src/endpoints/scenarios.tools.ts | Adds scopeId / resourceId to scenario tools. |
| src/endpoints/organizations.tools.ts | Adds scopeId / resourceId to organization tools. |
| src/endpoints/keys.tools.ts | Adds scopeId / resourceId to key tools. |
| src/endpoints/incomplete-executions.tools.ts | Adds scopeId / resourceId to incomplete execution tools. |
| src/endpoints/hooks.tools.ts | Adds scopeId / resourceId to hook tools. |
| src/endpoints/functions.tools.ts | Adds scopeId / resourceId to custom function tools. |
| src/endpoints/folders.tools.ts | Adds scopeId / resourceId to folder tools. |
| src/endpoints/executions.tools.ts | Adds scopeId / resourceId to execution tools. |
| src/endpoints/enums.tools.ts | Adds scopeId metadata (explicitly undefined) for enum tools. |
| src/endpoints/devices.tools.ts | Adds scopeId metadata to device tools. |
| src/endpoints/data-structures.tools.ts | Adds scopeId / resourceId to data structure tools. |
| src/endpoints/data-stores.tools.ts | Adds scopeId / resourceId to data store tools. |
| src/endpoints/data-store-records.tools.ts | Adds scopeId / resourceId to record tools. |
| src/endpoints/credential-requests.tools.ts | Adds scopeId / resourceId to credential-request tools. |
| src/endpoints/connections.tools.ts | Adds scopeId / resourceId to connection tools. |
| scripts/run-mcp-server.mjs | Updates the local MCP server runner to use MakeTools from dist/tools.js. |
| package.json | Bumps version and adds ./tools export mapping to dist/tools.*. |
| package-lock.json | Updates lockfile version metadata for the release bump. |
| README.md | Updates docs from MCP-specific tools to harness-agnostic @makehq/sdk/tools usage. |
| AGENTS.md | Updates contributor guidance from *.mcp.ts to *.tools.ts and registration via src/tools.ts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** Detailed description of what the tool does */ | ||
| description: string; | ||
|
|
||
| /** Category for organizing tools (e.g., 'scenarios', 'teams', 'sdk.apps') */ |
There was a problem hiding this comment.
MakeTool.category JSDoc example uses sdk.apps, but the repo conventions (and updated docs in AGENTS.md) use kebab-case for SDK categories (e.g. sdk-apps). Update the example to avoid documenting an invalid category format.
| /** Category for organizing tools (e.g., 'scenarios', 'teams', 'sdk.apps') */ | |
| /** Category for organizing tools (e.g., 'scenarios', 'teams', 'sdk-apps') */ |
| * required to run the tool (e.g. `scenarios:read`); `scopeId` names the | ||
| * input property, `scope` names the permission. | ||
| * | ||
| * The value SHOULD be a key in {@link inputSchema}.properties when set. |
There was a problem hiding this comment.
The scopeId JSDoc says its value SHOULD be a key in inputSchema.properties, but the new unit test suite enforces this as a hard invariant when scopeId is set. Consider changing the wording to MUST (or relaxing the test) so the documentation matches the enforced behavior.
| * The value SHOULD be a key in {@link inputSchema}.properties when set. | |
| * The value MUST be a key in {@link inputSchema}.properties when set. |
Summary
Makes the MCP-specific tool definitions harness-agnostic so the same
shape can power the MCP server,
@makehq/cli, and futureintegrations without duplicate adapters.
*.mcp.ts→*.tools.ts. New canonicalMakeTool/MakeToolsexports from a new./toolssubpath;MakeMCPTool/MakeMCPToolsstay as@deprecatedaliases.resourceIdnames the input property for the single resourcea tool operates on (get/update/delete/run-style actions).
identifier→scopeIdto disambiguate from OAuthscopeand from the new
resourceId.identifierstays as a@deprecatedalias and is kept in sync on every tool (enforcedby unit tests).
Backward compatibility
scopeId,resourceId) are additive and optional.MakeMCPTool/MakeMCPTools/identifierstill export withunchanged shape/values; mirror invariants enforced by tests.
Test plan
npm run lint— cleannpm test— 206/206 pass across 28 suitesresourceId/scopeIdhas the named key ininputSchema.propertiesscopeId === identifieron every toolexecutions_get/executions_get-detail(
scenarioId+executionId) andcredential-requests_get(
requestId)_list/_createand everysdk-*tool hasresourceId === undefined