MCPcopy Index your code
hub / github.com/AI45Lab/Code / write_file

Method write_file

sdk/node/src/lib.rs:3734–3742  ·  view source on GitHub ↗
(&self, path: String, content: String)

Source from the content-addressed store, hash-verified

3732 /// Write a file in the workspace.
3733 #[napi]
3734 pub async fn write_file(&self, path: String, content: String) -> napi::Result<ToolResult> {
3735 let session = self.inner.clone();
3736 let result = get_runtime()
3737 .spawn(async move { session.write_file(&path, &content).await })
3738 .await
3739 .map_err(|e| napi::Error::from_reason(format!("Task join error: {e}")))?
3740 .map_err(|e| napi::Error::from_reason(format!("{e}")))?;
3741 Ok(tool_result_from_core(result))
3742 }
3743
3744 /// List a directory in the workspace.
3745 #[napi]

Callers

nothing calls this directly

Calls 4

tool_result_from_coreFunction · 0.85
get_runtimeFunction · 0.70
cloneMethod · 0.45
spawnMethod · 0.45

Tested by

no test coverage detected