Skip to main content

Module tools

Module tools 

Source
Expand description

Tool definitions for ollama-rs function calling integration.

These tools provide the agent with the ability to read files, write files, run commands, and list files during spec execution.

Functions§

execute_tool
Execute a tool by name with the given arguments. Returns the result as a string to be sent back to the model.
get_tool_definitions
Get JSON schema definitions for all available tools. These schemas are passed to the ollama model to enable function calling.
list_files
List files matching a glob pattern. Example: list_files(“src/**/*.rs”) returns all Rust files in src/
read_file
Read the contents of a file at the given path. Use this to understand existing code before making changes.
run_command
Run a shell command and return its output. Use for: git operations, cargo build/test, file operations.
write_file
Write content to a file at the given path. Creates the file if it doesn’t exist, overwrites if it does.