Tools

Clew provides 78 built-in tools (353 files across 78 directories) plus dynamically loaded MCP tools. Tools are invoked by the AI model via tool_use blocks and executed through the StreamingToolExecutor with permission gating. The base tool type is defined in src/Tool.ts (782 lines) and tools are registered in src/tools.ts.

How Tools Work

Tools are defined with Zod schemas in src/Tool.ts via the buildTool() helper and registered in src/tools.ts. Each tool declares its input schema, output schema, concurrency safety, read-only status, and permission requirements.

Model emits tool_use
  Tool call normalization (toolCallParser.ts)
  Permission check (permissions.ts)
  PreToolUse hooks (plugins)
  Tool execution (StreamingToolExecutor)
  PostToolUse hooks (plugins)
  Result returned as tool_result
  Query loop continues

File & Code Operations

ToolDescriptionSchemas
Read (FileReadTool)Read files with line numbers, supports images, PDFs, Jupyter notebooksZod
Write (FileWriteTool)Create new files with full contentZod
Edit (FileEditTool)Exact string replacement edits (surgical, diff-based)Zod
Glob (GlobTool)Fast file pattern matching, sorted by modification timeZod
Grep (GrepTool)Regex content search with context lines and multiline supportZod
NotebookEdit (NotebookEditTool)Edit Jupyter notebook cells (replace, insert, delete)Zod
JsonPath (JsonPathTool)Query, validate, format, and transform JSON dataZod

Shell & System

ToolDescription
Bash (BashTool)Execute shell commands with timeout, background, sandbox support, and permission gating
PowerShell (PowerShellTool)PowerShell execution on Windows (feature-gated)
Monitor (MonitorTool)Stream stdout/stderr from background tasks in real-time
TaskOutput (TaskOutputTool)Get output from running or completed tasks
TaskStop (TaskStopTool)Stop running background tasks

Search & Web

ToolDescription
WebSearch (WebSearchTool)Multi-provider web search (Tavily, Brave, Serper, SearXNG, DuckDuckGo)
WebFetch (WebFetchTool)Fetch and analyze content from specific URLs
SessionSearch (SessionSearchTool)Full-text search across past session transcripts
ToolSearch (ToolSearchTool)Keyword search for deferred/lazy-loaded tools

Browser & Automation

ToolDescription
Browser (BrowserTool)Stealth Playwright browser — navigate, click, type, screenshot, extract, fill forms
ComputerUse (ComputerUseTool)Windows-only computer use automation (feature-gated: ENABLE_COMPUTER_USE)

Agent & Task Management

ToolDescription
Skill (SkillTool)Invoke skills and prompt-type commands by name
AskUserQuestion (AskUserQuestionTool)Ask the user interactive questions during execution
SendMessage (SendMessageTool)Send messages between agents in coordinator mode
EnterPlanMode (EnterPlanModeTool)Enter structured plan mode for complex tasks
ExitPlanMode (ExitPlanModeV2Tool)Exit plan mode and proceed with implementation
EnterWorktree / ExitWorktreeCreate/exit isolated git worktrees (feature-gated)
TaskCreate / TaskGet / TaskUpdate / TaskListStructured task tracking (V2 todo system)
TodoWrite (TodoWriteTool)Write todo items for task tracking
Config (ConfigTool)Configuration management (ant-only)
Brief (BriefTool)Generate brief summaries

Scheduled Tasks

Scheduled tasks can be created from the interactive /task form. The form collects a name, project, schedule type, prompt, and storage mode, then creates the matching cron task through the same scheduling runtime used by CronCreate, CronList, and CronDelete.

User actionBehavior
/taskOpen the interactive scheduled task form
Select Daily around 09:00Create a recurring daily task
Select Weekdays around 09:00Create a weekday cron such as 0 9 * * 1-5
Select In N minutes with 10Create a one-shot reminder
Select Custom cronUse a standard 5-field cron expression
/task scheduledOpen the same form explicitly
  • Durable storage persists tasks to .claude/scheduled_tasks.json across sessions.
  • Session-only storage keeps tasks in memory for the current session only.
  • Recurring tasks auto-expire after 30 days unless they are system-created permanent tasks.
  • One-shot tasks auto-delete after firing.
  • Natural language scheduling can still use the model-facing cron tools directly.
/task
Name: Server status
Schedule: Daily
Time: 20:00
Prompt: Check the server status
Storage: Durable

MCP (Model Context Protocol)

ToolDescription
ListMcpResources (ListMcpResourcesTool)List available resources from connected MCP servers
ReadMcpResource (ReadMcpResourceTool)Read resources exposed by MCP servers
MCP-provided toolsDynamically loaded tools from MCP servers (filesystem, database, APIs)

Feature-Gated Tools

ToolFlagDescription
LSP (LSPTool)ENABLE_LSP_TOOL=1Language Server Protocol integration
ComputerUseENABLE_COMPUTER_USE=1 (Win)Windows GUI automation
ToolSearchSTATSIG featureDeferred/lazy-loaded tool discovery
EnterWorktree / ExitWorktreeWorktree modeGit worktree isolation
TeamCreate / TeamDelete / RequestShutdownAgent swarmsMulti-agent team management
SubscribePrActivity / UnsubscribePrActivityAgent swarmsPR activity monitoring
CronCreate / CronDelete / CronListAGENT_TRIGGERSScheduled task triggers
PushNotificationKAIROSPush notification support

Tool Safety & Permissions

Each tool declares:

  • isEnabled() — Whether the tool is available in the current build
  • isConcurrencySafe() — Can run in parallel with other tools
  • isReadOnly() — Does not modify filesystem
  • isDestructive() — Performs irreversible operations
  • checkPermissions() — Tool-specific permission logic
  • validateInput() — Input validation before execution
  • maxResultSizeChars — Max result size before disk persistence

MCP tools from external servers are merged into the tool pool at runtime via assembleToolPool(). Tools are filtered by deny rules from the permission context.

CLAUDE_CODE_SIMPLE mode Setting CLAUDE_CODE_SIMPLE=1 or using --bare limits tools to a minimal set: Bash, Read, Edit.