Ollama Code includes built-in tools that the model uses to interact with your local environment, access information, and perform actions. These tools enhance the CLI’s capabilities, enabling it to go beyond text generation and assist with a wide range of tasks.
In the context of Ollama Code, tools are specific functions or modules that the model can request to be executed. For example, if you ask the model to “Summarize the contents of my_document.txt,” it will likely identify the need to read that file and will request the execution of the read_file tool.
The core component (packages/core) manages these tools, presents their definitions (schemas) to the model, executes them when requested, and returns the results to the model for further processing into a user-facing response.
These tools provide the following capabilities:
run_shell_command, the model can run shell commands (with appropriate safety measures and user confirmation).To use Ollama Code tools, provide a prompt to the CLI. The process works as follows:
You will typically see messages in the CLI indicating when a tool is being called and whether it succeeded or failed.
Many tools, especially those that can modify your file system or execute commands (write_file, edit, run_shell_command), are designed with safety in mind. Ollama Code will typically:
npx, the npx executable must be installed within the sandbox’s Docker image or be available in the sandbox-exec environment.It’s important to always review confirmation prompts carefully before allowing a tool to proceed.
Ollama Code’s built-in tools can be broadly categorized as follows:
run_shell_command): For executing shell commands.web_fetch): For retrieving content from URLs.web_search): For searching the web.read_many_files): A specialized tool for reading content from multiple files or directories, often used by the @ command.save_memory): For saving and recalling information across sessions.todo_write): For creating and managing structured task lists during coding sessions.task): For delegating complex tasks to specialized subagents.exit_plan_mode): For exiting plan mode and proceeding with implementation.Additionally, these tools incorporate: