Skip to content

Tools

CodeBuddy ships with 27+ tools that give it the ability to read, write, search, execute, debug, and automate across your development environment. These extend the built-in Deep Agents file system tools (ls, read_file, write_file, edit_file, glob, grep) provided by FilesystemMiddleware.

Tools are managed by the ToolProvider singleton, which initializes core tools at startup, lazily loads MCP tools in the background, and enforces permission scoping before any tool reaches an agent. All tools follow the LangChain StructuredTool format that the deepagents runtime expects.

The ToolProvider follows a factory pattern. Each tool is created by an IToolFactory implementation that produces a LangChain StructuredTool wrapper around a CodeBuddy-native tool class:

graph LR A["IToolFactory.createTool()"] --> B["LangChain StructuredTool"] B --> C["Agent tool call"] A --> D["CodeBuddy native tool<br/>(execute logic)"] B --> E["Schema validation (Zod)<br/>Permission check<br/>Role-based filtering"]
  1. ToolProvider.initialize() — Factory pattern creates 22 core tools, deduplicating by name.
  2. loadMCPToolsLazy() — Non-blocking background fetch from configured MCP servers. Does not block extension startup.
  3. getToolsForRole(role) — Pattern-matches tool names against the role’s allowed patterns from TOOL_ROLE_MAPPING.
  4. PermissionScopeService — Strips tools that the active security profile disallows.
  5. Tool execution — LangChain invokes the tool wrapper, which calls the native execute() method.
ToolParametersDescription
read_filesfilePath, class_name?, function_name?Read file contents with optional symbol filtering. Validates paths stay within workspace boundaries.
edit_filefilePath, mode: overwrite|replace, content?, search?, replace?Edit files with safe text replacement mode or full overwrite. Search/replace mode ensures precise targeted edits.
compose_fileslabel, edits: [{filePath, mode, content?, search?, replace?}]Atomic multi-file editing. Groups edits under a label for review and applies them as a batch.
list_filesdirPath?List directory contents with type indicators (file/folder).
ToolParametersDescription
ripgrep_searchPattern, glob, extra argsFast regex and text search across the codebase using ripgrep.
search_symbolsLSP-based queryLanguage-aware symbol search using the editor’s built-in language server protocol. Finds function definitions, classes, interfaces.
search_vector_dbquery: stringSemantic search over indexed codebase chunks via the embedded vector store.
travily_searchquery, maxResults? (default 5), includeRawContent?, timeout? (default 30s)Web search via the Tavily API. Returns formatted snippets with source URLs.
ToolParametersDescription
run_terminal_commandcommand, background?Execute a shell command. Background mode returns immediately for long-running processes like servers.
manage_terminalaction: start|execute|read|terminate, sessionId, command?, waitMs?Persistent terminal sessions with state. Start a session, execute commands, read output, or terminate.
run_testsTest framework native argsRun test suites using the project’s configured test runner. Returns structured pass/fail results.

Five tools provide full integration with the Debug Adapter Protocol (DAP):

ToolParametersDescription
debug_get_stateGet current debugger session state and active threads.
debug_get_stack_tracethreadId, startFrame, levelsGet the call stack for a specific thread.
debug_get_variablesframeId?, threadId?Get scoped variables (local, closure, global) for a stack frame.
debug_evaluateexpression, frameId?Evaluate an expression in the context of the current debug session.
debug_controlaction: stepOver|stepInto|stepOut|continue|pause, threadIdControl debugger execution flow.
ToolParametersDescription
browseraction, url?, ref?, text?, value?, expression?, key?, time?Headless browser automation via Playwright. Supports navigate, click, type, screenshot, snapshot, evaluate, hover, select_option, press_key, wait, tab management, and navigation history.
open_web_previewurlOpen a URL in the editor’s built-in browser panel for visual preview.
ToolParametersDescription
thinkthought: stringStructured reasoning tool. The agent uses this to plan, reflect, and reason through complex problems before acting. Output is passed through to the LLM context.
manage_core_memoryaction: add|update|delete|search, memory: {content, category, title, scope}, query?Persistent cross-session memory. See Memory system.
manage_tasksaction: add|update|list, task: {id?, content?, status?, priority?}Task/TODO list management for tracking progress on multi-step work.
get_architecture_knowledgesection?: all|overview|patterns|call-graph|middleware|endpoints|modelsRetrieve codebase architecture insights from static analysis. Returns structured data about patterns, dependency graph, entry points, etc. (12K char limit).
ToolParametersDescription
gitGit native operationsGit operations — status, log, diff, branch, commit, and more.
get_diagnosticsEditor diagnostics APIRetrieve compiler errors, linter warnings, and other diagnostics from the editor’s language services.
standup_intelligenceoperation: ingest|my_tasks|blockers|history, args: {notes?, person?, dateRange?}Parse and query standup meeting notes. Extracts tasks, blockers, and action items.
team_graphoperation: person_profile|top_collaborators|recurring_blockers|completion_trends|ticket_history|team_health|team_summary, args: {person?, limit?}Team collaboration analytics knowledge graph. Tracks who works on what, collaboration patterns, and task completion trends.

Any tool exposed by a connected MCP server is dynamically loaded and available as a LangChainMCPTool. MCP tools are added to every subagent unconditionally. See MCP integration for configuration details.

Each subagent receives a filtered subset of tools based on its role. The TOOL_ROLE_MAPPING maps role names to arrays of tool name patterns:

RoleTool patterns
code-analyzeranalyze, lint, security, search, terminal, ripgrep_search, get_diagnostics, git, browser
doc-writersearch, read, web, edit_file, compose_files, standup_intelligence, team_graph, browser
debuggerdebug_*, analyze, read, search, terminal, edit_file, get_diagnostics, browser
file-organizerfile, directory, terminal, git, list_files, edit_file, compose_files
architectsearch, think, standup_intelligence, team_graph, manage_core_memory, browser
revieweranalyze, lint, review, git, get_diagnostics, search_symbols, standup_intelligence
testerterminal, run_tests, edit_file, get_diagnostics, browser
architecture-expertget_architecture_knowledge, search, ripgrep_search, search_vector_db

MCP tools bypass role filtering — they are added to all subagents regardless of role.

Before tools are handed to any agent, the PermissionScopeService filters them based on the active security profile:

ProfileAllowed toolsBehavior
restrictedRead-only tools onlyread_file, search_files, list_files, search_vector_db, get_diagnostics, think, travily_search and similar. No writes, no terminal, no browser.
standardRead/write with safe terminalAll read-only tools plus edit_file, write_file, git, run_terminal_command, etc. Dangerous command patterns blocked. This is the default profile.
trustedAll toolsFull access with auto-approval for all operations.

The following command patterns are blocked in the standard profile. They are blocked unconditionally (in all profiles, including trusted) when they match catastrophic patterns:

CategoryExamples
Destructiverm -rf /, rmdir /
Diskmkfs, dd of=/dev/
Fork bomb:(){ :|: & };:
Remote code executioncurl ... | bash, wget ... | python
Privilege escalationchmod 777, chown root
Exfiltrationeval $...

Custom deny patterns can be configured per-workspace in .codebuddy/permissions.json:

{
"profile": "standard",
"commandDenyPatterns": ["docker rm", "kubectl delete"],
"toolBlocklist": ["browser"]
}