What problem does it solve?
Adding a new capability to Claude Code requires repeating many safety-focused defaults, eager schema construction at import time, and boilerplate for permissions and metadata. The buildTool factory centralizes those defaults, enforces lazy schema initialization, and makes a tool's true behavior easy to read and review.
Core Features & Use Cases
- Safe defaults: fills in isConcurrencySafe, isReadOnly, isDestructive, checkPermissions, isEnabled, and userFacingName so authors only implement meaningful overrides.
- Lazy schemas: uses lazySchema getters to avoid expensive schema construction at module load, improving startup performance.
- Permission and metadata hooks: encourages implementing checkPermissions, strict input validation, and registration with tools.ts for production readiness.
- Use Case: convert an ad-hoc utility function into a production tool with input validation, permission checks, and concise call logic.
Quick Start
Create a new tool by calling buildTool with a lazy inputSchema, implement call and checkPermissions only as needed, and register the tool in src/tools.ts.