pub struct ReadTool<const LINE_NUMBERS: bool = true> { /* private fields */ }Expand description
Tool for reading file contents with optional line numbers.
Restricts access to configured allowed directories.
Implementations§
Source§impl<const LINE_NUMBERS: bool> ReadTool<LINE_NUMBERS>
impl<const LINE_NUMBERS: bool> ReadTool<LINE_NUMBERS>
Sourcepub fn new(resolver: AllowedPathResolver) -> Self
pub fn new(resolver: AllowedPathResolver) -> Self
Creates a new read tool with a shared resolver.
Use a single AllowedPathResolver across all allowed tools to ensure
consistent path access:
use llm_coding_tools_core::path::AllowedPathResolver;
use llm_coding_tools_rig::allowed::{ReadTool, WriteTool, EditTool};
use std::path::PathBuf;
let resolver = AllowedPathResolver::new(vec![
std::env::current_dir().unwrap(),
PathBuf::from("/tmp"),
]).unwrap();
let read: ReadTool<true> = ReadTool::new(resolver.clone());
let write = WriteTool::new(resolver.clone());
let edit = EditTool::new(resolver);Trait Implementations§
Source§impl<const LINE_NUMBERS: bool> Tool for ReadTool<LINE_NUMBERS>
impl<const LINE_NUMBERS: bool> Tool for ReadTool<LINE_NUMBERS>
Source§type Output = ToolOutput
type Output = ToolOutput
The output type of the tool.
Source§async fn definition(&self, _prompt: String) -> ToolDefinition
async fn definition(&self, _prompt: String) -> ToolDefinition
A method returning the tool definition. The user prompt can be used to
tailor the definition to the specific use case.
Source§impl<const LINE_NUMBERS: bool> ToolContext for ReadTool<LINE_NUMBERS>
impl<const LINE_NUMBERS: bool> ToolContext for ReadTool<LINE_NUMBERS>
Auto Trait Implementations§
impl<const LINE_NUMBERS: bool> Freeze for ReadTool<LINE_NUMBERS>
impl<const LINE_NUMBERS: bool> RefUnwindSafe for ReadTool<LINE_NUMBERS>
impl<const LINE_NUMBERS: bool> Send for ReadTool<LINE_NUMBERS>
impl<const LINE_NUMBERS: bool> Sync for ReadTool<LINE_NUMBERS>
impl<const LINE_NUMBERS: bool> Unpin for ReadTool<LINE_NUMBERS>
impl<const LINE_NUMBERS: bool> UnwindSafe for ReadTool<LINE_NUMBERS>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more