MCPcopy Create free account
hub / github.com/AI45Lab/Code / write_text

Method write_text

core/src/workspace/local.rs:98–116  ·  view source on GitHub ↗
(
        &self,
        path: &WorkspacePath,
        content: &str,
    )

Source from the content-addressed store, hash-verified

96 }
97
98 async fn write_text(
99 &self,
100 path: &WorkspacePath,
101 content: &str,
102 ) -> WorkspaceResult<WorkspaceWriteOutcome> {
103 let resolved = self.local_path_for_write(path)?;
104 tokio::fs::write(&resolved, content).await.map_err(|e| {
105 WorkspaceError::Backend(anyhow!(
106 "Failed to write file {}: {}",
107 resolved.display(),
108 e
109 ))
110 })?;
111
112 Ok(WorkspaceWriteOutcome {
113 bytes: content.len(),
114 lines: content.lines().count(),
115 })
116 }
117
118 async fn list_dir(&self, path: &WorkspacePath) -> WorkspaceResult<Vec<WorkspaceDirEntry>> {
119 let target = self.local_path_for_read(path)?;

Calls 3

writeFunction · 0.85
local_path_for_writeMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected