Skip to content

Stop the trigger offering itself as an AI tool - #10

Merged
leggetter merged 3 commits into
mainfrom
fix/trigger-usable-as-tool
Aug 21, 2026
Merged

leggetter merged 3 commits into
mainfrom
fix/trigger-usable-as-tool

Conversation

@leggetter

@leggetter leggetter commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

n8n inverted the usableAsTool rule for trigger nodes. When this package was
written, omitting the property was a node-usable-as-tool error, so the
trigger set it. As of @n8n/eslint-plugin-community-nodes 0.29.0 — shipped in
@n8n/scan-community-package 0.32.0 — setting it on a trigger is the error,
and the rule no longer asks a trigger for the property at all.

The repo could not see this: ^0.31.0 on a 0.x version cannot reach 0.32.0,
so npm run scan kept passing against the scanner that had the old rule, while
the published 0.1.0 would fail n8n's actual review.

  • Bumped @n8n/scan-community-package ^0.31.0 → ^0.32.0
  • Bumped @n8n/node-cli ^0.42.2 → ^0.44.5
  • Removed usableAsTool: true from HookdeckEventGatewayTrigger
  • Kept usableAsTool: true on HookdeckEventGateway (the action node) — correct there, and the scanner agrees
  • Rewrote the stale comment block above the removed line
  • Added a unit test asserting the property's absence on the trigger and presence on the action node
  • CHANGELOG.md ## [Unreleased] entry
  • .agents/nodes.md: noted the trigger exception

Scan output, before and after — both against 0.32.0

Before (property still present):

❌ Failed n8n community package verification checks
Reason: ESLint violations found

nodes/Hookdeck/HookdeckEventGateway.node.ts
   40:9  warning  Icon is defined as a single file...  @n8n/community-nodes/icon-prefer-themed-variants

nodes/Hookdeck/HookdeckEventGatewayTrigger.node.ts
  146:9  warning  Icon is defined as a single file...  @n8n/community-nodes/icon-prefer-themed-variants
  178:3  error    Trigger nodes must not set usableAsTool: true. Trigger nodes cannot be
                  invoked as AI tools and doing so pollutes the tool picker. Remove this
                  property                              @n8n/community-nodes/node-usable-as-tool

✖ 3 problems (1 error, 2 warnings)

After:

✅ Passed n8n community package verification checks

For completeness, the same tree on the old 0.31.0 scanner passed — which is
exactly the problem this fixes.

Changelogs of the two bumps

Neither package ships a CHANGELOG.md, so I diffed the published tarballs.

@n8n/scan-community-package 0.31.0 → 0.32.0 — its only consumer-visible dependency
change is @n8n/eslint-plugin-community-nodes 0.28.0 → 0.29.0 (plus a @n8n/vitest-config
devDependency bump, irrelevant here). In that plugin bump, two rule files and one shared
util
changed, and no rules were added, removed, or re-severitied — dist/plugin.js,
which carries the configs and severities, is byte-identical:

File Change Affects this package
rules/node-usable-as-tool.js Triggers and AI-only nodes are now exempt from requiring the property and forbidden from setting it to true Yes — this PR
rules/trigger-node-conventions.js Pure refactor: the inline name.endsWith('Trigger') check became a call to the new isTriggerNodeClass, which is that same check. Behaviour unchanged No
utils/ast-utils.js Adds isTriggerNodeClass / hasTriggerGroup / isTriggerNode. Only node-usable-as-tool uses the group-aware isTriggerNode Only via the rule above

@n8n/node-cli 0.42.2 → 0.44.5 — its own dist/ is byte-identical apart from
build.tsbuildinfo. The real effect is transitive: the bundled plugin goes 0.27.0
→ 0.29.0, so npm run lint and npm run scan now run the same rule set instead
of two different ones. (@n8n/ai-node-sdk 0.23.2 → 0.25.5 is used by n8n-node dev
scaffolding, not by build or lint.) 0.44.5 is npm's latest/stable; 0.45.x
exists but is tagged beta, and it bundles the same plugin 0.29.0.

The lockfile diff is large (612 insertions) but entirely dev-tree churn: the set of
non-dev packages is unchanged, and the package declares no runtime dependencies,
so nothing that ships is affected.

Verification

Full pre-PR checklist, all passing:

Command Result
npm run lint ✖ 2 problems (0 errors, 2 warnings) — both the accepted icon-prefer-themed-variants warnings
npm run build ✓ Build successful
npm run scan ✅ Passed n8n community package verification checks
node scripts/verify-package-load.mjs ✅ Package loads the way n8n loads it (29 checks)
node --test test/unit.test.mjs tests 107 · pass 107 · fail 0

Beyond the checklist

The description object is otherwise byte-identical. I built the tree with and
without the change, instantiated both node classes, and diffed the full loaded
description objects plus webhookMethods, methods and webhook/execute.
The entire delta across 2,912 lines is one line:

       "outputs": [
         "main"
       ],
-      "usableAsTool": true,
       "credentials": [

The trigger still registers (verify-package-load.mjs lists it), still has all three
webhook methods (checkExists, create, delete) and still has listSearch.searchSources.

The behavioural change, run through n8n's own code. Rather than infer it, I called
n8n 2.35.6's shipped createAiTools() (n8n/dist/tool-generation/ai-tools.js) over the
real built descriptions:

BEFORE: tool variants generated: hookdeckEventGatewayTool, hookdeckEventGatewayTriggerTool
AFTER : tool variants generated: hookdeckEventGatewayTool

That also confirms the type name the changelog and the old comment claimed
(hookdeckEventGatewayTriggerTool), which was previously unverified.

Mutation check. Re-adding usableAsTool: true makes both the new unit test and
npm run scan fail, so neither guard is vacuous.

New test. One test, only the action node offers itself as an AI tool. It asserts
absence via 'usableAsTool' in description rather than === undefined, because the rule
rejects the property being set, and false is not what the rule's docs show as correct.
It is there because neither direction is visible in a build or a delivery test: re-adding
it fails n8n verification, and dropping it from the action node silently removes that node
from every agent's tool picker.

What I could NOT test

The live Hookdeck suites — ran and passed in CI. Locally they failed: with the
maintainer's go-ahead I ran npm run test:live against the key in the gitignored .env
and every test failed immediately with HTTP 401 Unauthorized on GET /sources. A
direct call with that key and the same Bearer scheme the credential uses also 401s, so
that local key has expired or been rotated — nothing to do with this change.

CI has a valid repository secret, and the integration job on this PR ran the suites for
real against the live API:

ℹ tests 40 · pass 37 · fail 0 · skipped 3

The 3 skips are pre-existing environmental ones, unrelated to this PR: delivery groups
are not enabled for this organization
, the Hookdeck CLI is not installed, and the
Stripe CLI is not logged in
. The middle one matters for the checklist below — "real
deliveries into the node" is skipped in CI
, so an actual inbound delivery is still
unverified by any automated run.

Worth fixing separately: the local .env key is dead, so npm run test:live currently
fails for anyone using it.

Checks 1 and 3 — now verified in a real running editor. n8n 2.35.6, Node 22.23.2,
this package linked through ~/.n8n/custom.

Querying /types/nodes.json — the feed the node panel and the AI tool picker both read —
from the logged-in editor returned 983 node types, of which exactly three are Hookdeck:

Node type group outputs codex
CUSTOM.hookdeckEventGateway transform main Development, Developer Tools, Custom Nodes
CUSTOM.hookdeckEventGatewayTrigger trigger main Development, Developer Tools, Custom Nodes
CUSTOM.hookdeckEventGatewayTool transform ai_tool AI
actionToolPresent  : true
triggerToolPresent : false
verdict            : PASS - action tool present, trigger tool absent

There is no hookdeckEventGatewayTriggerTool. That is the change this PR makes,
confirmed against a live registry rather than inferred. The node panel also lists the
package correctly — "Hookdeck Event Gateway" with Triggers (1) and Actions (30) —
and the trigger places on canvas.

Checks 4 and 5 — now verified against live Hookdeck traffic. Re-ran npm run test:live
with a valid key: 46 tests, 43 pass, 2 fail, 1 skipped. The delivery suite — the one CI
skips because it has no Hookdeck CLI — passed in full:

▶ real deliveries into the node
  ✔ the CLI forwards this source, signed with the node's own secret   (8.1s)
  ✔ a real event arrives with the documented output shape             (1.1s)   <- check 4
  ✔ a refused delivery is retried, and the retry is marked as one    (12.6s)
  ✔ deduplication collapses a repeat event at ingest                 (21.7s)
  ✔ events sent while paused are delivered once resumed              (16.2s)   <- check 5
✔ real deliveries into the node (61.5s)
✔ live API surface (44.3s)
✔ provisioning against an existing source (11.0s)
✔ vendor signature verification at the edge (20.9s)

That covers the documented output shape (check 4) and the pause/resume path (check 5)
against real traffic, which is stronger than driving it by hand in the editor.

The 2 failures and 1 skip are environmental, not this change:

  • Stripe delivers a signed event that Hookdeck verifies — the Stripe CLI's key has
    expired: stripe webhook_endpoints create … The API key provided has expired. Obtain a new key from the Dashboard or run 'stripe login'. Not an assertion about node
    behaviour. CI skips this suite entirely.
  • delivery groups are provisioned with key, limit and period — skipped, delivery groups
    are not enabled for this organization
    . Same as CI.

Check 2 (credential test) — verified, except for the green tick itself. Rather than
retype the request, I loaded the shipped HookdeckEventGatewayApi class from dist and
fired its own test.request resolved through its own authenticate expression — the same
inputs n8n uses:

request : GET https://api.hookdeck.com/2025-07-01/sources?limit=1
valid key            -> HTTP 200 OK           (n8n shows the green tick)
deliberately bad key -> HTTP 401 Unauthorized (correctly rejected)

The negative control is the point: a credential test that accepts anything would pass a
positive-only check while protecting nobody. What remains unverified is only the UI
affordance — clicking Save and seeing the tick — since that needs a key typed into the
form. The credential file is untouched by this PR.

Restart n8n after any rebuild — descriptions are read once at startup.

A CLI version floor this suite depends on, undocumented

The delivery suite first failed all five subtests. Cause: hookdeck listen forwards from
whichever project the CLI is logged into, and the local CLI was on an unrelated Outpost
project — precisely the failure describeCliSetup() in the trigger warns about:

hookdeck ci comes first deliberately: hookdeck listen otherwise uses whichever
project the CLI was last logged into, and picking the wrong one fails in a way that
looks like the node is broken rather than the CLI being pointed elsewhere.

Pinning per-checkout with hookdeck ci --local is the right fix, but on CLI < 2.5.0
--local also rewrites the global config
(hookdeck-cli#332,
fixed in 2.5.0). On 2.0.2 it silently switched the machine's active project. All results
above are from CLI 2.5.0.

Hence the second commit here: .hookdeck/ is now gitignored, because --local writes a
project API key into the working tree and nothing was ignoring it — in a repo that already
has a committed .env in its history.

Version recommendation

0.2.0.

The tension is worth stating once so nobody re-derives it. CONTRIBUTING.md's table calls
a removed node type MAJOR, and hookdeckEventGatewayTriggerTool genuinely does
disappear — verified above. But nobody can hold a working workflow that depends on it: it
was a tool that could not be invoked. Pre-1.0 both readings land on 0.2.0 anyway, so
it costs nothing either way. Recorded in the changelog entry rather than left implicit.

Per CONTRIBUTING.md, no version is set in this PR — the tag is the version.

Things that contradict the brief, or are worth a second look

  1. The scanner's "ignores inline eslint-disable" claim was taken on trust.
    Verified during review: @n8n/scan-community-package/scanner/scanner.mjs sets
    allowInlineConfig: false. A suppressed error really would be a hidden failure.

  2. .agents/nodes.md was byte-identical to @n8n/node-cli's shipped template, and
    upstream still carries the stale guidance
    even at 0.44.5. So n8n's own scaffolding
    doc contradicts n8n's own scanner rule. My edit is a deliberate local divergence and
    says so inline; it will conflict if the template is ever re-synced. Worth reporting
    upstream.

  3. Out of scope, fixed anyway (flagging explicitly): CONTRIBUTING.md documented
    npm run test:integration, which has not existed since Consolidate the integration suite under test/live #9 renamed it to test:live.
    One line. .github/workflows/integration.yml was already correct. CHANGELOG.md's
    0.1.0 entry also names test:integration, but that was accurate at 0.1.0, so per
    Keep a Changelog I left the historical entry alone.

  4. CHANGELOG.md 0.1.0 says "Both nodes are usable as agent tools." True when 0.1.0
    shipped, false now. Left as-is for the same reason — the Unreleased entry supersedes it.

  5. README needed no change. Its two "agent tool" mentions (lines 424, 500) are both
    about the action node and remain correct. README.md also cites end-to-end
    verification on n8n 2.34.4; I exercised n8n 2.35.6.

  6. Name collision in the node panel, worth knowing about. With this package linked,
    the editor's "More from the community" section also advertises n8n-nodes-hookdeck
    v1.0.3
    — a separate third-party package ("n8n community node for Hookdeck", author
    jonathan@joffcom.net, github.com/Joffcom/n8n-nodes-hookdeck). It renders as
    "Hookdeck" and "Hookdeck Tool" directly beneath ours in the panel. Nothing to do
    with this PR, and it briefly misled me — I first read "Hookdeck Tool" as our own tool
    node. Flagging it because users searching "hookdeck" will see both, and because the
    author appears to be the same person named as n8n's community engineer for the
    verification process. Worth confirming before submission.

  7. test/live leaks destinations. Snapshotting the project either side of a run:
    sources 8 → 8 and connections 9 → 9 (clean), but destinations 27 → 39. cleanUpRun
    filters on ownedByThisRun, which matches n8n-live-<run>-…, cli-n8n-live-<run>-…
    and n8n-<run>-<node> — but the node names destinations n8n-dest-<run>-<node>,
    which matches none of them, so every node-provisioned destination survives the sweep.
    This is the same bug the harness comment already records for connections ("The third
    was missing at first, so every node-provisioned connection survived cleanup") — fixed
    there, missed for destinations. All 39 in the project are n8n-dest-*. Not fixed here:
    unrelated to this PR and it touches deletion logic in a shared project.

  8. stripeReady() checks presence, not validity. It gates on Stripe config existing,
    so an expired Stripe key turns what should be a clean skip into a red failure — the
    same shape as the ingest bug this repo already fixed on the Hookdeck side.

  9. Two things I changed on your machine, both reported at the time: I restarted the
    n8n that had been running since Aug 12 (approved; it had no workflows or credentials),
    and I had to delete and let npm repopulate the ~/.npm/_npx/83f51bd5dfda7e85 cache
    after an interrupted install corrupted it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XtT85W8PPr2S8RW2WhCtpi

leggetter and others added 2 commits August 21, 2026 11:13
n8n inverted this rule. When these nodes were written, omitting `usableAsTool`
was a `node-usable-as-tool` error, so the trigger set it and carried a comment
explaining that the resulting `hookdeckEventGatewayTriggerTool` entry was noise
we had no way to opt out of. As of @n8n/eslint-plugin-community-nodes 0.29.0 —
shipped in @n8n/scan-community-package 0.32.0 — setting it on a trigger is the
error, and the rule no longer asks a trigger for the property at all.

The repo could not see this. `^0.31.0` on a 0.x version cannot reach 0.32.0, so
`npm run scan` kept passing against the scanner that had the bug while the
published package would fail n8n's actual review. Bumping the scanner reproduces
it at 178:3; removing the property clears it.

The action node keeps `usableAsTool: true`. It is the one an agent should be
calling, and the scanner agrees.

Running n8n 2.35.6's own createAiTools() over the built descriptions confirms
the behaviour either way: with the property it generates hookdeckEventGatewayTool
and hookdeckEventGatewayTriggerTool; without it, only the former. That is the
whole runtime delta — diffing the loaded description objects across the two
builds shows exactly one line removed and nothing else moved.

@n8n/node-cli goes to ^0.44.5 in the same change. Its own dist is unchanged from
0.42.2; what matters is that it pulls the same plugin 0.29.0, so `npm run lint`
and `npm run scan` now enforce one rule set rather than two.

Also fixes CONTRIBUTING.md, which still documented `npm run test:integration`
after #9 renamed it to `test:live`, and notes the trigger exception in
.agents/nodes.md, whose upstream copy has not caught up with the rule.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XtT85W8PPr2S8RW2WhCtpi
`test/live` drives `hookdeck listen`, which forwards from whichever project the
CLI is logged into. Pinning it per-checkout with `hookdeck ci --local` is the
right answer, but that writes a project API key to .hookdeck/config.toml in the
working tree, and nothing was ignoring it.

This repo already has a committed .env in its history. Adding the ignore before
the file can exist is cheaper than the alternative.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XtT85W8PPr2S8RW2WhCtpi
Review caught the comment this PR added being imprecise in the same way as the
one it replaced. `node-usable-as-tool` reports only the literal `true`; setting
`usableAsTool: false`, or the `{ replacements }` object form, is not an error.
Both the trigger comment and the test's assertion message said otherwise.

The test's use of `in` rather than `=== undefined` now carries the reason that
actually justifies it: n8n generates the tool variant for anything truthy, so
the object form passes the scan and still adds the entry. Verified against
n8n 2.35.6's createAiTools — `{ replacements }` produces `fakeTriggerTool`.

.env.example still pointed at `npm run test:integration`. The earlier sweep
grepped only *.md and *.yml, which is exactly the file a contributor opens first
when setting the live suite up.

.agents/nodes.md repeated upstream's "set to `false`" for binary-data nodes.
n8n-workflow types the property `true | UsableAsToolDescription`, so `false`
does not typecheck — and that loose wording is what both corrected comments
tripped over.

CHANGELOG promoted to 0.2.0, sections in Keep a Changelog order, and the
versioning rationale cut to the sentence a user can act on. README's verified-on
line moves to the n8n this was exercised against.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XtT85W8PPr2S8RW2WhCtpi
@leggetter
leggetter merged commit dde66f0 into main Aug 21, 2026
3 checks passed
@leggetter
leggetter deleted the fix/trigger-usable-as-tool branch August 21, 2026 13:03
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.

1 participant