Sub topic 5
What the agent can do: built-in tools
This chapter assumes you know the agent loop (plan, call a tool, observe the result, repeat) and the difference between ask, edit, and agent modes. It also assumes you can run build and test commands in a terminal.
The agent can't act on your project directly. It acts through tools. A tool is a function that the editor exposes to the model, such as "read this file" or "run this command." The model asks for a tool call, the editor runs it, and the result goes back into the conversation. Knowing the built-in tools tells you what the agent can and can't do.
The four tool groups
Names vary by editor and version. In VS Code with GitHub Copilot you can see the current list in the tools picker in the chat view. The built-in tools fall into four groups.
| Group | What it does | Typical use | Changes your project? |
|---|---|---|---|
| Search | Finds files by name or text, and finds symbols | Locating where `createUser` is defined | No |
| Read | Opens a file or a line range, and reads diagnostics | Checking a function before editing it | No |
| Edit | Creates files and changes existing ones | Adding validation and a test file | Yes |
| Terminal | Runs shell commands and reads their output | `npm test`, `git status`, a build | Possibly |
Search and read tools are low risk because they only gather information. Edit and terminal tools change things, so they are the ones to watch.
How the tools fit into the loop
A typical task uses the groups in order. The agent searches, reads, edits, then runs a command to check its work. The command output feeds the next round.
The return arrow from the terminal to the read step is what makes agent mode different from edit mode. The agent can see that a test failed and try again without you pasting the error.
What each group does in practice
Search tools take a query and return matches. Some search by text or pattern, and some search by symbol name. Results are only as good as the query. If the agent searches for the wrong word, it may miss the right file. Attaching the file yourself skips this step.
Read tools return file contents, often only a range of lines. Large files are read in pieces, so the agent may not see the whole file at once. This matters when a change depends on code far from where it started reading.
Edit tools apply changes to files in your workspace. The changes show up as diffs that you can accept or undo. Edits are made in place, so commit your work before a large task. A clean Git state gives you a checkpoint to return to.
The terminal tool runs commands in a shell and returns the output. The agent can only act on what it sees in that output. A command that hangs, asks for interactive input, or prints nothing gives the agent little to work with. Prefer commands that exit and report clearly, such as npm test rather than a watch mode.
Common errors
- The agent edits the wrong file. Its search matched a similar name. Name the file in your prompt or attach it.
- The agent says tests pass without running them. It may have skipped the terminal. State the command to run, for example "run
npm testand fix failures." - A command never finishes. Watch modes and dev servers keep running. Tell the agent to use a one-shot command.
- A tool is missing. The tool may be turned off in the picker, or it may need an MCP server. The MCP chapter covers adding tools.
Check your tool list
Open the tools picker and read the list. Turn off any tool you don't want the agent to use for this task. A shorter list reduces the chance of an unwanted action. It also makes the model's choices simpler.
Exercise
A prompt asks the agent to fix a failing test. The agent edits a source file, then reports success without running anything. Which tool group did it skip, and what should you add to the prompt?
Show answer
It skipped the terminal tool, so it never checked its own work. Add the exact command to the prompt, such as "run npm test and fix any failures," so the loop can observe real output.
Exercise
Which two tool groups can change your project, and why should you commit before a large task?
Show answer
Edit and terminal. Edits change files in place and commands can change files or state, so a commit gives you a checkpoint to return to.