MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / read_resource_status

Method read_resource_status

src/mcp/server.rs:2170–2195  ·  view source on GitHub ↗

Returns graph statistics as a JSON resource.

(&self, id: Value)

Source from the content-addressed store, hash-verified

2168
2169 /// Returns graph statistics as a JSON resource.
2170 async fn read_resource_status(&self, id: Value) -> JsonRpcResponse {
2171 let cg = self.reopen_if_branch_drifted().await;
2172 match cg.get_stats().await {
2173 Ok(stats) => {
2174 let mut output = serde_json::to_value(&stats).unwrap_or(json!({}));
2175 output["branch_diagnostics"] =
2176 serde_json::to_value(cg.branch_diagnostics()).unwrap_or(json!({}));
2177 let text = serde_json::to_string_pretty(&output).unwrap_or_default();
2178 JsonRpcResponse::success(
2179 id,
2180 json!({
2181 "contents": [{
2182 "uri": "tracedecay://status",
2183 "mimeType": "application/json",
2184 "text": text
2185 }]
2186 }),
2187 )
2188 }
2189 Err(e) => JsonRpcResponse::error(
2190 id,
2191 ErrorCode::InternalError,
2192 format!("failed to read graph stats: {e}"),
2193 ),
2194 }
2195 }
2196
2197 /// Returns the file list as a text resource (grouped by directory).
2198 async fn read_resource_files(&self, id: Value) -> JsonRpcResponse {

Callers 1

handle_resources_readMethod · 0.80

Calls 4

errorFunction · 0.85
branch_diagnosticsMethod · 0.80
get_statsMethod · 0.45

Tested by

no test coverage detected