Snapshot documentation of the built-in tools found in the imported yo-code source tree.
| Tool | Description | Key Features |
|---|---|---|
FileReadTool |
Read file contents | Line ranges, syntax highlighting, large file handling |
FileEditTool |
Edit files with SEARCH/REPLACE | Diff-based editing, conflict detection |
FileWriteTool |
Create or overwrite files | Directory creation, overwrite protection |
GlobTool |
Find files by pattern | Glob patterns, recursive search |
| Tool | Description | Key Features |
|---|---|---|
BashTool |
Execute shell commands | Permission modes, sandbox, timeouts |
PowerShellTool |
Windows PowerShell | Windows-specific commands |
| Tool | Description | Key Features |
|---|---|---|
GrepTool |
Search file contents | Regex support, file filtering |
ToolSearchTool |
Search available tools | Tool discovery by name/description |
| Tool | Description | Key Features |
|---|---|---|
WebSearchTool |
Search the web | Query-based search results |
WebFetchTool |
Fetch URL contents | HTML extraction, content parsing |
| Tool | Description | Key Features |
|---|---|---|
AgentTool |
Spawn subagents | Isolated context, parallel execution |
TaskCreateTool |
Create tasks | Task tracking, status updates |
TaskGetTool |
Get task details | Task information retrieval |
TaskListTool |
List all tasks | Task overview |
TaskOutputTool |
Get task output | Task result retrieval |
TaskStopTool |
Stop a task | Task cancellation |
TaskUpdateTool |
Update task | Task metadata updates |
| Tool | Description | Key Features |
|---|---|---|
MCPTool |
Call MCP server tools | External tool execution |
ListMcpResourcesTool |
List MCP resources | Resource discovery |
ReadMcpResourceTool |
Read MCP resource | Resource content retrieval |
McpAuthTool |
MCP authentication | OAuth flow for MCP servers |
| Tool | Description | Key Features |
|---|---|---|
LSPTool |
Language Server Protocol | Code intelligence, diagnostics |
| Tool | Description | Key Features |
|---|---|---|
EnterPlanModeTool |
Enter planning mode | Structured planning workflow |
ExitPlanModeTool |
Exit planning mode | Plan execution |
EnterWorktreeTool |
Enter git worktree | Isolated development |
ExitWorktreeTool |
Exit git worktree | Worktree cleanup |
| Tool | Description | Key Features |
|---|---|---|
AskUserQuestionTool |
Ask user for input | Interactive clarification |
SendMessageTool |
Send messages | Inter-agent communication |
RemoteTriggerTool |
Trigger remote actions | Remote session control |
| Tool | Description | Key Features |
|---|---|---|
TodoWriteTool |
Manage todo lists | Task tracking |
SleepTool |
Delay execution | Timed waits |
SkillTool |
Load skills | Dynamic skill loading |
ConfigTool |
Manage configuration | Settings updates |
BriefTool |
Generate briefs | Task summaries |
ScheduleCronTool |
Schedule cron jobs | Recurring tasks |
REPLTool |
REPL execution | Interactive sessions |
NotebookEditTool |
Edit notebooks | Jupyter notebook support |
All tools implement a standardized interface:
interface Tool {
// Tool identification
name: string;
description: string;
// Input validation
inputSchema: ToolInputJSONSchema;
// Execution
execute(
input: Record<string, unknown>,
context: ToolUseContext
): Promise<ToolResult>;
}Provides execution context:
interface ToolUseContext {
appState: AppState;
canUseTool: CanUseToolFn;
appendSystemMessage?: (msg: SystemMessage) => void;
setAppState?: (updater: (state) => newState) => void;
// ... additional context
}Standardized result format:
interface ToolResult {
content: ContentBlock[];
isError?: boolean;
// ... additional fields
}Tools support three permission modes:
| Mode | Behavior |
|---|---|
auto-approve |
Execute without asking |
ask |
Prompt user for approval |
deny |
Block execution |
// Before executing any tool
const permission = await canUseTool(toolName, input, context);
if (!permission.approved) {
return { content: [], isError: true };
}The most complex and security-sensitive tool.
-
Permission Modes:
- Auto-approve for safe commands
- Ask for potentially destructive commands
- Deny for blocked commands
-
Command Classification:
- Read-only commands (ls, cat, grep, etc.)
- Write commands (echo >, touch, etc.)
- Dangerous commands (rm -rf, dd, etc.)
-
Sandbox Execution:
- Optional containerized execution
- File system restrictions
- Network isolation
-
Output Handling:
- Truncation for large outputs
- ANSI stripping
- Error stream separation
interface BashConfig {
permissionMode: 'auto' | 'ask' | 'deny';
sandboxEnabled: boolean;
timeoutMs: number;
maxOutputBytes: number;
allowlist: string[];
blocklist: string[];
}Diff-based file editing with conflict detection.
<<<<<<< SEARCH
original code here
=======
replacement code here
>>>>>>> REPLACE
- Multiple edits: Apply multiple SEARCH/REPLACE blocks
- Conflict detection: Detect when search text doesn't match
- Undo support: File history for rollback
- Large file handling: Efficient diff application
Subagent spawning for parallel task execution.
// Spawn a subagent
const result = await runForkedAgent({
promptMessages: [createUserMessage({ content: task })],
canUseTool: createCanUseTool(context),
querySource: 'subagent',
forkLabel: 'task',
skipTranscript: true,
});- Isolated context: Separate message history
- Shared tools: Access to parent's tool set
- Abort support: Cancellation via AbortController
- Progress reporting: Real-time status updates
- Resource limits: Token and cost tracking
- Create tool directory:
src/tools/MyTool/
├── MyTool.ts
├── constants.ts
├── prompt.ts
└── index.ts
- Implement tool interface:
export const MY_TOOL_NAME = 'MyTool';
export function createMyTool(): Tool {
return {
name: MY_TOOL_NAME,
description: 'Description of what the tool does',
inputSchema: z.object({
param1: z.string().describe('Parameter description'),
param2: z.number().optional(),
}),
execute: async (input, context) => {
// Implementation
return { content: [{ type: 'text', text: 'Result' }] };
},
};
}- Register in
src/tools.ts:
import { createMyTool } from './tools/MyTool';
export function getTools(): Tools {
return {
// ... existing tools
MyTool: createMyTool(),
};
}LLM generates tool_use block
│
▼
┌─────────────────────┐
│ Parse tool name │
│ and input │
└────────┬────────────┘
│
▼
┌─────────────────────┐
│ Validate input │
│ against schema │
└────────┬────────────┘
│
▼
┌─────────────────────┐
│ Check permissions │
│ (auto/ask/deny) │
└────────┬────────────┘
│
┌────┴────┐
│ │
▼ ▼
Denied Approved
│ │
│ ▼
│ ┌─────────────┐
│ │ Execute │
│ │ tool │
│ └──────┬──────┘
│ │
│ ▼
│ ┌─────────────┐
│ │ Format │
│ │ result │
│ └──────┬──────┘
│ │
▼ ▼
┌─────────────────────┐
│ Append tool_result │
│ to message history │
└────────┬────────────┘
│
▼
┌─────────────────────┐
│ Continue query │
│ (LLM processes │
│ tool result) │
└─────────────────────┘
The system enforces various limits:
| Limit | Description |
|---|---|
| Max tool calls per turn | Prevents infinite loops |
| Max output size | Truncates large outputs |
| Timeout | Kills long-running tools |
| Concurrent tools | Limits parallel execution |
| File size limits | Restricts file operations |
See src/constants/toolLimits.ts for specific values.