MCPcopy Create free account
hub / github.com/JaredStewart/coderlm / get_structure

Function get_structure

server/src/server/routes.rs:273–299  ·  view source on GitHub ↗
(
    State(state): State<AppState>,
    headers: HeaderMap,
    Query(params): Query<StructureQuery>,
)

Source from the content-addressed store, hash-verified

271}
272
273async fn get_structure(
274 State(state): State<AppState>,
275 headers: HeaderMap,
276 Query(params): Query<StructureQuery>,
277) -> Result<Json<Value>, AppError> {
278 let project = require_project(&state, &headers)?;
279 let depth = params.depth.unwrap_or(0);
280 let detail = params.detail.unwrap_or(0);
281
282 if detail > 0 {
283 let result = structure::get_structure_with_detail(
284 &project.root,
285 &project.file_tree,
286 &project.symbol_table,
287 depth,
288 detail,
289 );
290 let preview = format!("{} files (L{})", result.file_count, detail);
291 record_history(&state, session_id(&headers).as_deref(), "GET", "/structure", &preview);
292 Ok(Json(serde_json::to_value(result).unwrap()))
293 } else {
294 let result = structure::get_structure(&project.file_tree, depth);
295 let preview = format!("{} files", result.file_count);
296 record_history(&state, session_id(&headers).as_deref(), "GET", "/structure", &preview);
297 Ok(Json(serde_json::to_value(result).unwrap()))
298 }
299}
300
301#[derive(Deserialize)]
302struct DefineRequest {

Callers

nothing calls this directly

Calls 4

require_projectFunction · 0.85
record_historyFunction · 0.85
session_idFunction · 0.85

Tested by

no test coverage detected