MCPcopy Create free account
hub / github.com/Louisym/MiniCC / run_pre_tool_use

Method run_pre_tool_use

tutorials/08_hook_system.py:127–140  ·  view source on GitHub ↗

运行所有 PreToolUse hook。 如果任何一个 hook 返回"拒绝",工具就不会被执行。

(self, tool_name: str, tool_input: str)

Source from the content-addressed store, hash-verified

125 self.config = config
126
127 def run_pre_tool_use(self, tool_name: str, tool_input: str) -> HookRunResult:
128 """
129 运行所有 PreToolUse hook。
130
131 如果任何一个 hook 返回"拒绝",工具就不会被执行。
132 """
133 return self._run_commands(
134 event=HookEvent.PRE_TOOL_USE,
135 commands=self.config.pre_tool_use,
136 tool_name=tool_name,
137 tool_input=tool_input,
138 tool_output=None,
139 is_error=False,
140 )
141
142 def run_post_tool_use(
143 self, tool_name: str, tool_input: str,

Callers 1

mainFunction · 0.95

Calls 1

_run_commandsMethod · 0.95

Tested by

no test coverage detected