Built-in Tools

AnyLLM comes with a set of powerful tools that allow the AI to interact with your file system. These tools are triggered by using special syntax in the AI's responses.

File System Tools

These tools enable the AI to read, write, and list files, as well as search for content within them.

1. List Files (ls)

To list the contents of a directory, the AI uses the [[LS:path]] syntax.

  • path: The path to the directory you want to list. If omitted, it lists the current directory.

Example:

To list files in the src directory:

[[LS:src]]

2. Read File (read)

To read the contents of a file, the AI uses the [[READ:path/to/file]] syntax.

  • path/to/file: The path to the file you want to read.

Example:

[[READ:src/Command/RunCommand.php]]

The AI will then receive the content of the file as part of the conversation history.

3. Create or Overwrite File (file)

To create a new file or overwrite an existing one, the AI uses a block structure.

[[FILE:path/to/file]]
... content ...
[[ENDFILE]]
  • path/to/file: The path to the file to be created or overwritten.
  • ... content ...: The content to be written to the file.

When this tool is used, AnyLLM will show you a diff of the changes before applying them, so you can see exactly what modifications are being made.

Example:

[[FILE:src/new_feature.php]]
<?php

class NewFeature
{
    // ...
}
[[ENDFILE]]

4. Search Files (grep)

To search for a specific term within files, the AI uses the [[GREP:search term]] syntax. This is useful for finding where a particular function or variable is used.

  • search term: The text or pattern to search for.

Example:

To find all occurrences of RunCommand:

[[GREP:RunCommand]]

The tool will return a list of files and line numbers where the term was found.