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

Method status

core/src/tools/builtin/git.rs:166–200  ·  view source on GitHub ↗

Show repository status.

(&self, ctx: &ToolContext, git: &dyn WorkspaceGit)

Source from the content-addressed store, hash-verified

164impl GitTool {
165 /// Show repository status.
166 async fn status(&self, ctx: &ToolContext, git: &dyn WorkspaceGit) -> Result<ToolOutput> {
167 match git.status().await {
168 Ok(status) => {
169 let status_str = if status.is_dirty {
170 format!("{} uncommitted change(s)", status.dirty_count)
171 } else {
172 "clean".to_string()
173 };
174
175 Ok(ToolOutput::success(format!(
176 "Workspace: {}\n\
177 Branch: {}\n\
178 Commit: {}\n\
179 Status: {}\n\
180 Worktree: {}",
181 ctx.workspace_services.workspace_ref().display_root,
182 status.branch,
183 status.commit,
184 status_str,
185 if status.is_worktree {
186 "yes (linked)"
187 } else {
188 "no (main)"
189 }
190 ))
191 .with_metadata(serde_json::json!({
192 "branch": status.branch,
193 "is_worktree": status.is_worktree,
194 "dirty_count": status.dirty_count,
195 "is_dirty": status.is_dirty,
196 })))
197 }
198 Err(e) => Ok(ToolOutput::error(format!("Failed to get status: {e}"))),
199 }
200 }
201
202 /// Show commit log.
203 async fn log(&self, args: &serde_json::Value, git: &dyn WorkspaceGit) -> Result<ToolOutput> {

Callers 3

executeMethod · 0.45
executeMethod · 0.45

Calls 1

with_metadataMethod · 0.45

Tested by

no test coverage detected