KCode CLIBuilt-in Tools

Built-in Tools

KCode ships with 46 built-in tools for code exploration, modification, and automation.

File Operations

ToolDescription
ReadRead file contents (supports images, PDFs, notebooks)
WriteCreate new files
EditExact string replacement in existing files
MultiEditMultiple edits in a single tool call
GlobFind files by pattern (e.g., **/*.tsx)
GrepSearch file contents with regex (powered by ripgrep)
GrepReplaceFind-and-replace across files with regex
RenameRename or move files/directories
LSList directory contents
DiffViewView diffs between files or commits

Execution

ToolDescription
BashExecute shell commands with safety analysis
AgentSpawn subagents (general, explore, plan, custom)
TestRunnerRun tests with framework auto-detection

Git

ToolDescription
GitStatusShow working tree status
GitCommitCreate commits
GitLogView commit history

Web

ToolDescription
WebFetchFetch and extract content from URLs (SSRF-protected)
WebSearchSearch the web

Worktrees

ToolDescription
EnterWorktreeCreate an isolated git worktree for safe experimentation
ExitWorktreeLeave and optionally merge worktree changes

Planning & Tasks

ToolDescription
PlanModeEnter/exit structured multi-step task planning
TaskCreateCreate tasks with dependencies
TaskGetRead task details
TaskListList all tasks
TaskUpdateUpdate task status
TaskStopCancel a running task
TaskOutputGet task output

Scheduling

ToolDescription
CronCreateSchedule recurring commands
CronListList scheduled jobs
CronDeleteRemove scheduled jobs

Session & Memory

ToolDescription
ClipboardCopy/paste to system clipboard
UndoRevert the last file change
StashStash/restore work in progress

LSP

ToolDescription
LSPLanguage Server Protocol integration (go-to-definition, references, diagnostics)

Communication

ToolDescription
AskUserRequest clarification from the user
SendMessageInter-agent communication in swarm mode
SkillInvoke registered slash command skills
ToolSearchDiscover available deferred tools

MCP Tools

KCode supports the Model Context Protocol for external tool servers.

MCP tools appear alongside built-in tools. You can restrict which tools each server exposes:

// ~/.kcode/settings.json
{
  "mcpServers": {
    "my-server": {
      "command": "npx",
      "args": ["my-mcp-server"],
      "allowedTools": ["read_*", "search_*"],
      "blockedTools": ["dangerous_tool"]
    }
  }
}

Bash Safety

KCode analyzes bash commands before execution:

  • Flags destructive operations (rm -rf, git reset --hard)
  • Detects secrets in arguments
  • Warns about network-affecting commands
  • Detects command injection patterns (pipe-to-shell, quote desync)
  • Requires explicit approval for risky operations
  • Protected system directories (/etc, /usr, /bin) are blocked for writes