Skip to main content
Glama

build_hooks_config

Read-onlyIdempotent

Configure pre- and post-execution hooks for sandbox-native tools (code_execution, file operations). Pre-hooks allow or deny tool calls; post-hooks run after execution.

Instructions

Build a hooks.json config for sandbox-native tool interception (code_execution, read/write/list/delete_file).

Hooks only fire for sandbox-native tools, never for function calling or mcp_server tools. Mount the result at target ".agents/hooks.json" via build_environment_config's inline sources so the sandbox picks it up automatically.

Args: pre_tool_execution: List of {"matcher": "<RE2 regex, e.g. 'code_execution' or '.*_file'>", "hooks": [{"type": "command"|"http", "command"|"url": "...", "timeout": 10}]}. A "command" hook receives the tool call as JSON on stdin and must print {"decision": "allow"} or {"decision": "deny", "reason": "..."} to stdout. post_tool_execution: Same matcher/hooks shape; runs after execution, cannot block, output ignored. group_name: Top-level key grouping this hook set. enabled: Whether this group is active.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
enabledNo
group_nameNodefault
pre_tool_executionNo
post_tool_executionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate readOnlyHint=true and idempotentHint=true. The description adds context about hook scope (sandbox-native only), mounting behavior, and argument behavior (timeout, command/http output format). No contradictions with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured: a concise purpose statement followed by a scope note, mounting instruction, and a clear Args block. Every sentence adds value; no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description fully covers the tool's purpose, usage, and arguments. Input schema is simple (no required params) and description compensates fully. Output schema exists, so return values need not be described. No gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but the description fully compensates with detailed Args explaining pre_tool_execution, post_tool_execution, group_name, and enabled, including their shape, defaults, and behavior (e.g., matcher regex, command/http hooks, timeout).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool builds a hooks.json config for sandbox-native tool interception, listing specific tools like code_execution and read/write/list/delete_file. It distinguishes itself from siblings like build_environment_config and build_mcp_server_tool_config by focusing on hooks configuration.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains that hooks only fire for sandbox-native tools, not for function calling or MCP server tools, and instructs where to mount the result (.agents/hooks.json) via build_environment_config. It provides detailed argument format but could explicitly state when to use this tool versus environment config tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bgembalczyk/agent-antigravity-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server