PreToolUse

PreToolUse is a hook for Claude Code from Raven-Scout/Scout. Its token cost is not measured, scanned A, original, MIT.

A pre-tool hook that runs before calls to MCP tools, a way for an agent to use connected external services. It invokes Scout's tool-gating command when the project's configuration enables restricted tools.

In plain words
What is it for?
Applying a project's access rules to MCP tool calls.
Why use it?
It can prevent or control restricted external-tool calls before they run. If restriction is not configured, the hook does nothing.

Hook for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_ROOT} variable. Also seen: names the NotebookEdit tool.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the scout plugin — 6 skills, 7 commands, 3 hooks shipped together

One of 3 entries in hooks.json upstream. Installing this one merges just its entry into your config; the other 2 are separate, each on its own page.

Good fit Applying a project's access rules to MCP tool calls.

Compare 6 hooks from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add Raven-Scout/Scout
Claude Code
/plugin install scout

Made for: Claude Code.

Or install scout, the plugin that ships this one along with the rest of its 6 skills, 7 commands, 3 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for PreToolUse

README.md
[![agentmods](https://agentmods.dev/badge/hooks/raven-scout/scout/pre-tool-use/github.svg)](https://agentmods.dev/hooks/raven-scout/scout/pre-tool-use)
Your own site
<a href="https://agentmods.dev/hooks/raven-scout/scout/pre-tool-use"><img src="https://agentmods.dev/badge/hooks/raven-scout/scout/pre-tool-use/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for PreToolUse

Your own site · 80×15
<a href="https://agentmods.dev/hooks/raven-scout/scout/pre-tool-use"><img src="https://agentmods.dev/badge/hooks/raven-scout/scout/pre-tool-use.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Security

Grade A, and why

PreToolUse scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the commands this hook runs, not an audit. A hook is shell that executes on your machine at the event it names, which is why every command in it is printed with what was found.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugin/hooks/hooks.json · 54 lines

How it starts

The opening of the file, as written. The whole thing — 54 lines — stays where its author put it; the contents beside it link to each section on GitHub.

{
  "PreToolUse": [
    {
      "matcher": "mcp__.*",
      "hooks": [
        {
          "type": "command",
          "command": "h=\"${CLAUDE_PLUGIN_ROOT}/hooks/prefilter.sh\"; c=\"${CLAUDE_PLUGIN_ROOT}/engine/bin/scoutctl\"; s=0; if [ -s \"$h\" ] && [ -r \"$h\" ]; then /bin/sh \"$h\" mcp-tool-gate \"$c\" hook mcp-tool-gate; s=$?; [ \"$s\" -ge 200 ] && exit $((s - 200)); fi; [ \"$s\" -ge 128 ] && { [ -n \"$SCOUT_MODE\" ] || { [ -n \"${SCOUT_READER+set}\" ] && [ \"$SCOUT_READER\" != owner ]; }; } && { echo \"[scout:mcp-tool-gate] Scout's hook pre-filter failed (exit $s), so this call is blocked in a scheduled run.\" >&2; exit 2; }; \"$c\" hook mcp-tool-gate && exit 0; s=$?; d=\"$PWD\"; [ -z \"$SCOUT_DATA_DIR\" ] || d=; while [ \"${d#/}\" != \"$d\" ] && [ ! -f \"$d/scout-config.yaml\" ]; do [ \"$d\" = / ] && exit 1; d=\"${d%/*}\"; d=\"${d:-/}\"; done; echo \"[scout:mcp-tool-gate] Scout's MCP tool gate could not start (status $s), so this call is blocked in a vault. Run /scout-update or \\`scoutctl bootstrap doctor\\`.\" >&2; exit 2",
          "timeout": 10
        }
      ]
    },
    {
      "matcher": "^mcp__.+__.*(send|create|update|save|post|add|delete|remove|schedule|comment|reply|draft|upload|edit|merge|close|reopen|set|archive|review|forward|complete|write|publish|share|invite).*$",
      "hooks": [
        {
          "type": "command",
          "command": "h=\"${CLAUDE_PLUGIN_ROOT}/hooks/prefilter.sh\"; c=\"${CLAUDE_PLUGIN_ROOT}/engine/bin/scoutctl\"; s=0; if [ -s \"$h\" ] && [ -r \"$h\" ]; then /bin/sh \"$h\" outbound-gate \"$c\" hook outbound-gate; s=$?; [ \"$s\" -ge 200 ] && exit $((s - 200)); fi; if [ \"$s\" -lt 128 ] || ! { [ -n \"$SCOUT_MODE\" ] || { [ -n \"${SCOUT_READER+set}\" ] && [ \"$SCOUT_READER\" != owner ]; }; }; then \"$c\" hook outbound-gate; s=$?; [ \"$s\" -eq 0 ] && exit 0; fi; [ -n \"$SCOUT_MODE\" ] || { [ -n \"${SCOUT_READER+set}\" ] && [ \"$SCOUT_READER\" != owner ]; } || exit 1; [ \"$s\" -eq 2 ] || echo \"[scout:outbound-gate] Scout

Read the full file on GitHub · 54 lines

Same file

What else hooks.json configures

This page is one entry in a file that holds 3. Installing the file brings all of them; each is measured and scanned on its own page.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday Changed ec43577c3c7a
  2. 5d ago Changed 78140f126985
  3. 6d ago Changed dde7217353b3
  4. 9d ago Changed · +10 lines 4fa4c5f6d33c
  5. 12d ago Changed 58affba6cc67
  6. 16d ago Changed b6c301c4ed8f
  7. 19d ago Changed 1d3ecc4e3ba4
  8. 26d ago Changed · +30 lines dd9da8a10d99
  9. 1mo ago First seen · 14 lines scan A 341b620df451

Subscribe to this mod's changes

PreToolUse is a hook published in the GitHub repository Raven-Scout/Scout (20 stars, last pushed today), licensed MIT. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-22.

Related

PreToolUse compared with hooks from other repositories

PreToolUse next to 6 hooks from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
PreToolUseRaven-Scout/ScoutHook20todayMITA—Claude Code
Stopricher-richard/cc-researchHook16mo agoMITA—Claude Code
TaskCompletedNova-Violet-Role/RoT-DTD-GOALHook23mo agononeA—Claude Code
ConfigChangeNova-Violet-Role/RoT-DTD-GOALHook23mo agononeA—Claude Code
SessionStartsupabase/supabaseHook116ktodayApache-2.0A—Claude Code
PostToolUsesupabase/supabaseHook116ktodayApache-2.0A—Claude Code
SessionStartgoogle-gemini/gemini-cliHook109ktodayApache-2.0A—Claude Code