Skip to content

Document Patch tool input hooks and chat channel filter context - #452

Closed
mhornbacher wants to merge 1 commit into
sathya/add-agent-guardrails-docfrom
menachem.hornbacher/docs/patch-tool-input-hook
Closed

Document Patch tool input hooks and chat channel filter context#452
mhornbacher wants to merge 1 commit into
sathya/add-agent-guardrails-docfrom
menachem.hornbacher/docs/patch-tool-input-hook

Conversation

@mhornbacher

Copy link
Copy Markdown

Documents two additions to tool call hooks for their launch.

Stacked on #432 — that PR rewrites tool-call-hooks.mdx (new pre-output event, filter-variables-by-event table, eleven built-in patterns), so this targets its branch rather than main to avoid conflicting edits. Retarget to main once #432 merges.

What changed

product/admin/tool-call-hooks.mdx only.

New hook type — ## Patch tool input hooks, placed between the built-in patterns and custom function sections, since it sits between them in complexity. Follows the depth of the neighboring type sections: what it's for, the pre-tool-use-only constraint, the two configuration modes (CEL expression and static JSON), a ### Patch expression variables table (ctx, input, caller), ### How the patch is applied, and two worked examples — stamping a scope onto Datadog calls from one Slack channel, and a static patch that pins one field and drops another.

The merge behavior is explained in plain terms first — a key is added, overwritten, or removed when set to null, and unmentioned keys are untouched — with a link to JSON Merge Patch for precision rather than as the explanation. This matches how the docs cite specs elsewhere (for example step-up auth linking RFC 9470).

New filter context — ### Chat channel context under Configure a hook, documenting ctx.surface and ctx.channel_id on the pre-tool-use and post-tool-use events. Emphasizes that both are absent rather than empty for calls that didn't come from a chat channel, so filters need has() first — otherwise the expression fails to evaluate and the fail-closed rule denies the call. The existing Filter variables by event table points here, and the context block in the custom function payload gains both fields.

Also updated: the frontmatter description, the Hook type and Event rows of the configuration form table, and the hook-type step of the setup flow.

Test plan

  • npx mintlify broken-links — no new broken links; the 10 reported are pre-existing in unrelated files. All new anchors verified against real headings.
  • Review the rendered preview.

Adds a "Patch tool input hooks" section covering the two configuration
modes (CEL expression and static JSON), the variables a patch expression
can read, the add/overwrite/remove-via-null merge rules, and two worked
examples.
Documents the ctx.surface and ctx.channel_id filter variables now
available on the pre-tool-use and post-tool-use events, including that
they are absent rather than empty for calls that didn't originate in a
chat channel, and adds them to the custom function payload.
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@mhornbacher
mhornbacherforce-pushed the menachem.hornbacher/docs/patch-tool-input-hook branch from ea1dec1 to 01bff7bCompareAugust 11, 2026 18:10
@mhornbacherC1 Squire [DEV]

Copy link
Copy Markdown
Author

Closing — this was mistakenly stacked on an unmerged branch (sathya/add-agent-guardrails-doc). Filters are GA, so this doc addition doesn't need to wait on that branch; redoing it directly against main in a new PR.

Sign up for freeto 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

@mhornbacher