| Crates.io | cats |
| lib.rs | cats |
| version | 0.1.2 |
| created_at | 2025-10-26 11:27:58.383257+00 |
| updated_at | 2025-10-31 16:10:11.755083+00 |
| description | Coding Agent ToolS - A comprehensive toolkit for building AI-powered coding agents |
| homepage | https://cats.podtan.com |
| repository | https://github.com/podtan/cats |
| max_upload_size | |
| id | 1901259 |
| size | 359,840 |
A comprehensive toolkit for building AI-powered coding agents. CATS provides structured, LLM-friendly tools for file manipulation, code editing, search, and execution that work seamlessly with language models.
Add CATS to your Cargo.toml:
[dependencies]
cats = "0.1.0"
use cats::{create_tool_registry, ToolArgs};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create the tool registry
let mut registry = create_tool_registry();
// Execute a tool
let args = ToolArgs::from_args(&["src/main.rs"]);
let result = registry.execute_tool("open", &args)?;
println!("{}", result.message);
Ok(())
}
use cats::create_tool_registry_with_open_window_size;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create registry with custom window size for file viewing
let mut registry = create_tool_registry_with_open_window_size(50);
// Now 'open' tool will show 50 lines at a time
Ok(())
}
open - Opens a file and displays a window of linesgoto - Jumps to a specific line number in the current filescroll_up - Scrolls the viewing window upscroll_down - Scrolls the viewing window downfind_file - Search for files by name patternsearch_file - Search for text within a specific filesearch_dir - Search for text across all files in a directorycreate_file - Create a new file with contentreplace_text - Replace text using search/replace patterninsert_text - Insert text at a specific linedelete_text - Delete a range of linesdelete_line - Delete a specific lineoverwrite_file - Replace entire file contentsdelete_function - Delete a Rust function by name (Rust-aware)delete_path - Delete a file or directorymove_path - Move or rename a file/directorycopy_path - Copy a file or directorycreate_directory - Create a new directoryrun_command - Execute shell commands with timeout and validation_state - Display current tool state and contextcount_tokens - Count tokens in a file (requires tiktoken feature)filemap - Generate a project structure visualizationsubmit - Mark task as completeclassify_task - Classify task type for workflow routinguse cats::{create_tool_registry, ToolArgs};
use std::collections::HashMap;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut registry = create_tool_registry();
// LLMs typically provide JSON with named parameters
let mut args = HashMap::new();
args.insert("file_path".to_string(), "src/main.rs".to_string());
args.insert("insert_line".to_string(), "10".to_string());
args.insert("new_str".to_string(), "// New comment".to_string());
let tool_args = ToolArgs::from_named(args);
let result = registry.execute_tool("insert_text", &tool_args)?;
println!("{}", result.message);
Ok(())
}
use cats::{create_tool_registry, ToolArgs};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut registry = create_tool_registry();
let args = ToolArgs::from_args(&["src", "TODO"]);
let result = registry.execute_tool("search_dir", &args)?;
println!("{}", result.message);
Ok(())
}
tiktoken (Optional)Enable token counting functionality using the cl100k_base tokenizer:
[dependencies]
cats = { version = "0.1.0", features = ["tiktoken"] }
With this feature enabled, you can use the count_tokens tool:
use cats::{create_tool_registry, ToolArgs};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut registry = create_tool_registry();
let args = ToolArgs::from_args(&["src/main.rs"]);
let result = registry.execute_tool("count_tokens", &args)?;
println!("{}", result.message); // "Total tokens: 1234"
Ok(())
}
CATS is designed with LLM integration as a first-class concern:
ToolResult types with clear success/error statesuse cats::create_tool_registry;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let registry = create_tool_registry();
// Get all tool schemas for OpenAI function calling
let schemas = registry.get_all_schemas();
// Send schemas to OpenAI API as available functions
// ... your OpenAI integration code ...
Ok(())
}
CATS includes a binary that can be used standalone:
# Install the CLI
cargo install cats
# Use tools from command line
cats open src/main.rs
cats search_dir . "TODO"
cats filemap src/
simpaticoder-toolsCATS is the successor to simpaticoder-tools. The crate has been renamed and extracted for independent use:
# Old (deprecated)
[dependencies]
simpaticoder-tools = "0.1.0"
# New
[dependencies]
cats = "0.1.0"
Update imports:
// Old
use simpaticoder_tools::{create_tool_registry, ToolArgs};
// New
use cats::{create_tool_registry, ToolArgs};
The API surface remains identical - only the crate name has changed.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Licensed under either of:
at your option.
CATS is inspired by and builds upon concepts from:
Built for the future of AI-assisted software development. π