Add AI-accessible tools for reading structured files (CSV, JSON/JSONC, Markdown, SQL) and searching repository content (git_grep). Also adds git_blob_get to retrieve raw blob text content with binary detection. Deferred: Excel, Word, PDF, PPT modules are stubbed out due to library API incompatibilities (calamine 0.26, lopdf 0.34, quick-xml 0.37).
40 lines
1.3 KiB
Rust
40 lines
1.3 KiB
Rust
//! File reading and search tools for AI agents.
|
|
//!
|
|
//! Tools for reading structured files (CSV, Excel, Word, PDF, PPT, Markdown,
|
|
//! SQL, JSON) and searching across repository files (git_grep).
|
|
//!
|
|
//! All tools operate on repository blobs (read via git context) or standalone
|
|
//! content, returning structured JSON suitable for AI consumption.
|
|
|
|
pub mod csv;
|
|
// TODO: fix calamine 0.26 API compatibility (open_workbook path requirement)
|
|
// pub mod excel;
|
|
pub mod grep;
|
|
pub mod json;
|
|
pub mod markdown;
|
|
// TODO: fix lopdf 0.34 API (no load_from_mem, different stream API)
|
|
// pub mod pdf;
|
|
// TODO: fix ppt archive borrow checker issue
|
|
// pub mod ppt;
|
|
pub mod sql;
|
|
// TODO: fix quick-xml 0.37 + zip Cursor API
|
|
// pub mod word;
|
|
|
|
use agent::ToolRegistry;
|
|
|
|
/// Maximum number of bytes to read from any single file (prevents huge blobs).
|
|
const MAX_FILE_SIZE: usize = 2 * 1024 * 1024; // 2MB
|
|
|
|
/// Registers all file tools into a ToolRegistry.
|
|
pub fn register_all(registry: &mut ToolRegistry) {
|
|
grep::register_grep_tools(registry);
|
|
csv::register_csv_tools(registry);
|
|
// excel::register_excel_tools(registry);
|
|
// word::register_word_tools(registry);
|
|
// pdf::register_pdf_tools(registry);
|
|
// ppt::register_ppt_tools(registry);
|
|
markdown::register_markdown_tools(registry);
|
|
sql::register_sql_tools(registry);
|
|
json::register_json_tools(registry);
|
|
}
|