# ToolPreExecutionHook

**Kind:** Type

**Source:** [`atloria-monorepo/libs/agent-core/src/runtime/types.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/agent-core/src/runtime/types.ts#L397)

Called BEFORE a tool executes. Can block execution entirely and return
an error/guidance message instead — the tool never runs.

This enables hard tool blocking (e.g., plan mode) where write tools
are genuinely prevented from executing, matching Claude Code's behavior.

Return `undefined` or `null` to allow execution.
Return a string to BLOCK execution and use that string as the tool output.

## Definition

```ts
(
  toolName: string,
  toolInput: string,
) => string | null | undefined | Promise<string | null | undefined>
```
