pub struct ClientReadFile {
pub extra_roots: Vec<(PathBuf, AccessTier)>,
pub session_roots: Option<SharedSandboxRoots>,
/* private fields */
}Expand description
A tool that reads a file from the ACP client’s buffer (IDE/editor).
The agent calls this when the client has declared fs.readTextFile=true.
The tool forwards the read request to the client, which returns the file
contents from its unsaved buffer.
If the client returns an error or does not respond within
client_read_timeout_ms, the tool falls back to a local filesystem
read (S2-E2).
Fields§
§extra_roots: Vec<(PathBuf, AccessTier)>Additional sandbox roots beyond the primary workspace, each tagged with an access tier.
session_roots: Option<SharedSandboxRoots>Session-scoped, runtime-mutable roots (e.g. added via the TUI /add-dir command).
Implementations§
Source§impl ClientReadFile
impl ClientReadFile
Sourcepub fn with_acp_state(self, state: Arc<Mutex<AcpClientFsState>>) -> Self
pub fn with_acp_state(self, state: Arc<Mutex<AcpClientFsState>>) -> Self
Set the shared ACP client FS state.
This links the tool to the ACP session manager’s capability state so the tool can determine whether to execute or return an error.
Sourcepub fn with_client_read_timeout(self, timeout_ms: u64) -> Self
pub fn with_client_read_timeout(self, timeout_ms: u64) -> Self
Set the client read timeout in milliseconds (default 5000).
Sourcepub fn with_extra_roots(
self,
extra: impl IntoIterator<Item = (PathBuf, AccessTier)>,
) -> Self
pub fn with_extra_roots( self, extra: impl IntoIterator<Item = (PathBuf, AccessTier)>, ) -> Self
Append additional allowed sandbox roots.
Sourcepub fn with_session_roots_opt(self, slot: Option<SharedSandboxRoots>) -> Self
pub fn with_session_roots_opt(self, slot: Option<SharedSandboxRoots>) -> Self
Convenience: attach the shared slot only when Some.
Trait Implementations§
Source§impl Tool for ClientReadFile
impl Tool for ClientReadFile
fn spec(&self) -> ToolSpec
fn execute<'life0, 'async_trait>(
&'life0 self,
arguments: Value,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn kind(&self) -> ToolKind
fn kind(&self) -> ToolKind
ToolKind for tool_call notifications (Sprint 3).
Defaults to ToolKind::Other. Concrete tools override to map
to their corresponding ACP category.Source§fn side_effect_class(&self) -> ToolSideEffect
fn side_effect_class(&self) -> ToolSideEffect
External) so any unannotated tool is treated
as risky on resume. Override to ReadOnly or Mutating for
built-in tools; MCP tools derive this from their annotations.Source§fn is_deferred(&self) -> bool
fn is_deferred(&self) -> bool
true to send this tool as deferred (name-only) in the initial
prompt; the model must call ToolSearch to load its full schema.
Default is false (eager). Override in low-frequency tools.Source§fn is_readonly(&self) -> bool
fn is_readonly(&self) -> bool
ReadOnly.
Used by the parallel-dispatch path in agent.rs. Override only if
you have an unusual reason (you almost never should — override
side_effect_class instead and let this default through).