Built-in Tools

Complete reference for every tool available to the AI out of the box — parameters, return values, and examples.

info How Tools Work

LexiChat uses the Ollama tool-calling API. When you send a message, the model receives a list of available tools alongside your message. If it decides a tool is needed, it emits a structured JSON call — LexiChat intercepts this, executes the tool in the Rust backend, and feeds the result back to the model in the next turn.

Agentic loop
Your message
Model thinks
Tool call
Tool result
Model responds

The loop can repeat multiple times in a single response if the model needs to call several tools.

draft

read_file

Read the contents of a file in an allowed directory
Parameter Type Required Description
path string yes Absolute path to the file (must be within an allowed directory)
Returns

The full UTF-8 contents of the file as a string. Binary files return an error.

// Example: ask the AI to summarise a document
// User says: "Summarise ~/Documents/LexiChat/report.md"

{
  "name": "read_file",
  "arguments": {
    "path": "/Users/alice/Documents/LexiChat/report.md"
  }
}
edit_document

write_file

Write content to a file in an allowed directory
Parameter Type Required Description
path string yes Full absolute path including filename and extension
content string yes The text content to write. Overwrites the file if it already exists.
warning
Overwrites existing files without confirmation. If the path doesn't exist, it is created (including intermediate directories, as long as they're within an allowed directory).
// User says: "Write a haiku about mountains and save it"
{
  "name": "write_file",
  "arguments": {
    "path": "/Users/alice/Documents/LexiChat/mountain_haiku.txt",
    "content": "Silent peaks above\nClouds drift past ancient granite\nEcho of the wind"
  }
}
folder_open

list_directory

List the contents of a directory in an allowed path
Parameter Type Required Description
path string yes Absolute path to the directory to list
Returns

A list of filenames and subdirectory names in the specified directory (one level deep, not recursive).

// User says: "What files do I have in my LexiChat folder?"
{
  "name": "list_directory",
  "arguments": {
    "path": "/Users/alice/Documents/LexiChat"
  }
}

// Returned to model
["report.md", "mountain_haiku.txt", "notes/", "archive/"]

visibility Tool Indicators in Chat

Every time the AI calls a tool, a small indicator appears inline in the conversation so you can see exactly what it's doing:

⚙ web_search("ollama release") — shown while the search is running
⚙ read_file("/Users/alice/Documents/report.md") — shown while reading

security Security Notes

lock
Path sandboxing — all file tools enforce the allowed-directory whitelist in Rust before any filesystem operation. No amount of prompt injection can escape this boundary.
visibility
Full transparency — every tool call and its arguments are shown in the chat. You can always see exactly what the AI is doing and stop it mid-stream if needed.
cloud_off
No exfiltration — tool results go back to your local Ollama model only. No tool sends data to any external service (web_search sends the query to DuckDuckGo but not your file contents).