smart-tree 8.0.1

Smart Tree - An intelligent, AI-friendly directory visualization tool
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
// Consolidated MCP Tools - Reducing from 50+ to ~15 tools
// Each tool now has a 'mode' or 'type' parameter to specify the operation

use crate::mcp::McpContext;
use anyhow::{Context, Result};
use serde_json::{json, Value};
use std::sync::Arc;

/// Consolidated find tool - combines all find_* operations
pub async fn handle_find(params: Option<Value>, ctx: Arc<McpContext>) -> Result<Value> {
    let params = params.context("Parameters required")?;
    let find_type = params["type"].as_str().context("type parameter required")?;

    // Transform parameters to match original tool format and dispatch
    let transformed_params = match find_type {
        "files" => params.clone(),
        "code" => {
            // Transform to find_code_files format
            params.clone()
        }
        "config" | "documentation" | "tests" | "build" => {
            // These just need path
            json!({ "path": params.get("path").unwrap_or(&json!(".")) })
        }
        "large" => {
            json!({
                "path": params.get("path").unwrap_or(&json!(".")),
                "min_size": params.get("min_size").unwrap_or(&json!("10M"))
            })
        }
        "recent" => {
            json!({
                "path": params.get("path").unwrap_or(&json!(".")),
                "days": params.get("days").unwrap_or(&json!(7))
            })
        }
        "timespan" => params.clone(),
        "duplicates" | "empty_dirs" => {
            json!({ "path": params.get("path").unwrap_or(&json!(".")) })
        }
        "projects" => {
            // Projects discovery - finds forgotten 3am coding gems!
            json!({
                "path": params.get("path").unwrap_or(&json!(".")),
                "depth": params.get("depth").unwrap_or(&json!(10))
            })
        }
        _ => return Err(anyhow::anyhow!("Unknown find type: {}", find_type)),
    };

    // Call the appropriate original tool
    let tool_name = match find_type {
        "files" => "find_files",
        "code" => "find_code_files",
        "config" => "find_config_files",
        "documentation" => "find_documentation",
        "tests" => "find_tests",
        "build" => "find_build_files",
        "large" => "find_large_files",
        "recent" => "find_recent_changes",
        "timespan" => "find_in_timespan",
        "duplicates" => "find_duplicates",
        "empty_dirs" => "find_empty_directories",
        "projects" => "find_projects",
        _ => return Err(anyhow::anyhow!("Unknown find type: {}", find_type)),
    };

    // Call through the regular tools handler
    super::tools::handle_tools_call(
        json!({ "name": tool_name, "arguments": transformed_params }),
        ctx,
    )
    .await
}

/// Consolidated analyze tool - combines analysis operations
pub async fn handle_analyze(params: Option<Value>, ctx: Arc<McpContext>) -> Result<Value> {
    let params = params.context("Parameters required")?;
    let mode = params["mode"].as_str().context("mode parameter required")?;

    // Transform parameters based on the tool
    let (tool_name, transformed_params) = match mode {
        "directory" => {
            // analyze_directory expects 'mode' not 'format', but we rename 'format' to 'mode'
            let mut p = params.clone();
            if let Some(format) = p.get("format") {
                p["mode"] = format.clone();
                p.as_object_mut().unwrap().remove("format");
            }
            // Remove the consolidated 'mode' field as analyze_directory doesn't expect it
            p.as_object_mut().unwrap().remove("mode");
            ("analyze_directory", p)
        }
        "workspace" => ("analyze_workspace", params.clone()),
        "statistics" => ("get_statistics", params.clone()),
        "git_status" => ("get_git_status", params.clone()),
        "digest" => ("get_digest", params.clone()),
        "semantic" => ("semantic_analysis", params.clone()),
        "quantum-semantic" => {
            // quantum-semantic uses analyze_directory with quantum-semantic mode
            let mut p = params.clone();
            p["mode"] = json!("quantum-semantic");
            ("analyze_directory", p)
        }
        "size_breakdown" => ("directory_size_breakdown", params.clone()),
        "ai_tools" => ("analyze_ai_tool_usage", params.clone()),
        _ => return Err(anyhow::anyhow!("Unknown analyze mode: {}", mode)),
    };

    super::tools::handle_tools_call(
        json!({ "name": tool_name, "arguments": transformed_params }),
        ctx,
    )
    .await
}

/// Consolidated search tool
pub async fn handle_search(params: Option<Value>, ctx: Arc<McpContext>) -> Result<Value> {
    super::tools::handle_tools_call(
        json!({ "name": "search_in_files", "arguments": params }),
        ctx,
    )
    .await
}

/// Consolidated overview tool - quick_tree and project_overview
pub async fn handle_overview(params: Option<Value>, ctx: Arc<McpContext>) -> Result<Value> {
    let params = params.context("Parameters required")?;
    let mode = params
        .get("mode")
        .and_then(|m| m.as_str())
        .unwrap_or("quick");

    let tool_name = match mode {
        "quick" => "quick_tree",
        "project" => "project_overview",
        _ => return Err(anyhow::anyhow!("Unknown overview mode: {}", mode)),
    };

    super::tools::handle_tools_call(json!({ "name": tool_name, "arguments": params }), ctx).await
}

/// Consolidated edit tool - combines all Smart Edit operations
pub async fn handle_edit(params: Option<Value>, ctx: Arc<McpContext>) -> Result<Value> {
    let params = params.context("Parameters required")?;
    let operation = params["operation"].as_str().context("operation required")?;

    let tool_name = match operation {
        "smart_edit" => "smart_edit",
        "get_functions" => "get_function_tree",
        "insert_function" => "insert_function",
        "remove_function" => "remove_function",
        "create_file" => "create_file",
        _ => return Err(anyhow::anyhow!("Unknown edit operation: {}", operation)),
    };

    super::tools::handle_tools_call(json!({ "name": tool_name, "arguments": params }), ctx).await
}

/// Consolidated history tool - file tracking and history
pub async fn handle_history(params: Option<Value>, ctx: Arc<McpContext>) -> Result<Value> {
    let params = params.context("Parameters required")?;
    let operation = params["operation"].as_str().context("operation required")?;

    let tool_name = match operation {
        "track" => "track_file_operation",
        "get_file" => "get_file_history",
        "get_project" => "get_project_history_summary",
        _ => return Err(anyhow::anyhow!("Unknown history operation: {}", operation)),
    };

    super::tools::handle_tools_call(json!({ "name": tool_name, "arguments": params }), ctx).await
}

/// Consolidated context tool - project context and collaboration
pub async fn handle_context(params: Option<Value>, ctx: Arc<McpContext>) -> Result<Value> {
    let params = params.context("Parameters required")?;
    let operation = params["operation"].as_str().context("operation required")?;

    let tool_name = match operation {
        "gather_project" => "gather_project_context",
        "collaboration_rapport" => "get_collaboration_rapport",
        "engagement_heatmap" => "get_co_engagement_heatmap",
        "cross_domain_patterns" => "get_cross_domain_patterns",
        "suggest_insights" => "suggest_cross_session_insights",
        _ => return Err(anyhow::anyhow!("Unknown context operation: {}", operation)),
    };

    super::tools::handle_tools_call(json!({ "name": tool_name, "arguments": params }), ctx).await
}

/// Consolidated memory tool - collaborative memories
pub async fn handle_memory(params: Option<Value>, ctx: Arc<McpContext>) -> Result<Value> {
    let params = params.context("Parameters required")?;
    let operation = params["operation"].as_str().context("operation required")?;

    let tool_name = match operation {
        "anchor" => "anchor_collaborative_memory",
        "find" => "find_collaborative_memories",
        _ => return Err(anyhow::anyhow!("Unknown memory operation: {}", operation)),
    };

    super::tools::handle_tools_call(json!({ "name": tool_name, "arguments": params }), ctx).await
}

/// Consolidated compare tool
pub async fn handle_compare(params: Option<Value>, ctx: Arc<McpContext>) -> Result<Value> {
    super::tools::handle_tools_call(
        json!({ "name": "compare_directories", "arguments": params }),
        ctx,
    )
    .await
}

/// Consolidated SSE tool - Server-Sent Events
pub async fn handle_sse(params: Option<Value>, ctx: Arc<McpContext>) -> Result<Value> {
    super::tools::handle_tools_call(
        json!({ "name": "watch_directory_sse", "arguments": params }),
        ctx,
    )
    .await
}

/// Consolidated feedback tool
pub async fn handle_feedback(params: Option<Value>, ctx: Arc<McpContext>) -> Result<Value> {
    let params = params.context("Parameters required")?;
    let operation = params["operation"].as_str().context("operation required")?;

    let tool_name = match operation {
        "submit" => "submit_feedback",
        "request_tool" => "request_tool",
        "check_updates" => "check_for_updates",
        _ => return Err(anyhow::anyhow!("Unknown feedback operation: {}", operation)),
    };

    super::tools::handle_tools_call(json!({ "name": tool_name, "arguments": params }), ctx).await
}

/// Get consolidated tool list
#[allow(dead_code)]
pub fn get_consolidated_tools() -> Vec<Value> {
    vec![
        json!({
            "name": "find",
            "description": "Find files, code, config, tests, documentation, duplicates, etc.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": ["files", "code", "config", "documentation", "tests", "build",
                                 "large", "recent", "timespan", "duplicates", "empty_dirs"],
                        "description": "Type of items to find"
                    },
                    "path": {
                        "type": "string",
                        "description": "Path to search in"
                    },
                    "pattern": {
                        "type": "string",
                        "description": "Pattern to match (for files type)"
                    },
                    "languages": {
                        "type": "array",
                        "items": { "type": "string" },
                        "description": "Programming languages (for code type)"
                    },
                    "days": {
                        "type": "integer",
                        "description": "Number of days (for recent type)"
                    },
                    "min_size": {
                        "type": "string",
                        "description": "Minimum size (for large type)"
                    },
                    "start_date": {
                        "type": "string",
                        "description": "Start date YYYY-MM-DD (for timespan type)"
                    },
                    "end_date": {
                        "type": "string",
                        "description": "End date YYYY-MM-DD (for timespan type)"
                    },
                    "limit": {
                        "type": "integer",
                        "description": "Maximum number of results to return (for pagination)"
                    },
                    "offset": {
                        "type": "integer",
                        "description": "Number of results to skip (for pagination)"
                    }
                },
                "required": ["type"]
            }
        }),
        json!({
            "name": "analyze",
            "description": "Analyze directories, workspaces, statistics, git status, etc.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "type": "string",
                        "enum": ["directory", "workspace", "statistics", "git_status",
                                 "digest", "semantic", "size_breakdown", "ai_tools"],
                        "description": "Analysis mode"
                    },
                    "path": {
                        "type": "string",
                        "description": "Path to analyze"
                    },
                    "format": {
                        "type": "string",
                        "description": "Output format (for directory mode)"
                    },
                    "max_depth": {
                        "type": "integer",
                        "description": "Maximum depth"
                    },
                    "show_hidden": {
                        "type": "boolean",
                        "description": "Show hidden files"
                    }
                },
                "required": ["mode"]
            }
        }),
        json!({
            "name": "search",
            "description": "Search for content within files",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "keyword": {
                        "type": "string",
                        "description": "Keyword or pattern to search"
                    },
                    "path": {
                        "type": "string",
                        "description": "Path to search in"
                    },
                    "case_sensitive": {
                        "type": "boolean",
                        "description": "Case sensitive search"
                    },
                    "file_type": {
                        "type": "string",
                        "description": "File type to search"
                    },
                    "context_lines": {
                        "type": "integer",
                        "description": "Number of context lines"
                    },
                    "include_content": {
                        "type": "boolean",
                        "description": "Include file content in results"
                    }
                },
                "required": ["keyword"]
            }
        }),
        json!({
            "name": "overview",
            "description": "Get quick tree overview or comprehensive project overview",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "type": "string",
                        "enum": ["quick", "project"],
                        "description": "Overview mode"
                    },
                    "path": {
                        "type": "string",
                        "description": "Path to overview"
                    },
                    "depth": {
                        "type": "integer",
                        "description": "Maximum depth (for quick mode)"
                    }
                },
                "required": []
            }
        }),
        json!({
            "name": "edit",
            "description": "Smart code editing operations - AST-aware with 90% token reduction",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "operation": {
                        "type": "string",
                        "enum": ["smart_edit", "get_functions", "insert_function", "remove_function"],
                        "description": "Edit operation"
                    },
                    "file_path": {
                        "type": "string",
                        "description": "File to edit"
                    },
                    "edits": {
                        "type": "array",
                        "description": "Array of edit operations (for smart_edit)",
                        "items": {
                            "type": "object",
                            "description": "Individual edit operation"
                        }
                    },
                    "name": {
                        "type": "string",
                        "description": "Function name"
                    },
                    "body": {
                        "type": "string",
                        "description": "Function body"
                    }
                },
                "required": ["operation", "file_path"]
            }
        }),
        json!({
            "name": "history",
            "description": "Track and retrieve file operation history",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "operation": {
                        "type": "string",
                        "enum": ["track", "get_file", "get_project"],
                        "description": "History operation"
                    },
                    "file_path": {
                        "type": "string",
                        "description": "File path"
                    },
                    "project_path": {
                        "type": "string",
                        "description": "Project path"
                    },
                    "op": {
                        "type": "string",
                        "description": "File operation type"
                    },
                    "old_content": {
                        "type": "string",
                        "description": "Previous content"
                    },
                    "new_content": {
                        "type": "string",
                        "description": "New content"
                    }
                },
                "required": ["operation"]
            }
        }),
        json!({
            "name": "context",
            "description": "Project context, collaboration rapport, and cross-domain patterns",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "operation": {
                        "type": "string",
                        "enum": ["gather_project", "collaboration_rapport", "engagement_heatmap",
                                 "cross_domain_patterns", "suggest_insights"],
                        "description": "Context operation"
                    },
                    "project_path": {
                        "type": "string",
                        "description": "Project path"
                    },
                    "ai_tool": {
                        "type": "string",
                        "description": "AI tool name"
                    },
                    "keywords": {
                        "type": "array",
                        "items": { "type": "string" },
                        "description": "Keywords for search"
                    }
                },
                "required": ["operation"]
            }
        }),
        json!({
            "name": "memory",
            "description": "Anchor and find collaborative memories",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "operation": {
                        "type": "string",
                        "enum": ["anchor", "find"],
                        "description": "Memory operation"
                    },
                    "context": {
                        "type": "string",
                        "description": "Memory context"
                    },
                    "keywords": {
                        "type": "array",
                        "items": { "type": "string" },
                        "description": "Keywords"
                    },
                    "anchor_type": {
                        "type": "string",
                        "description": "Type of anchor"
                    },
                    "origin": {
                        "type": "string",
                        "description": "Who created this? 'human', 'ai:claude', or 'tandem:human:claude' (default: tandem:human:claude)"
                    }
                },
                "required": ["operation", "keywords"]
            }
        }),
        json!({
            "name": "compare",
            "description": "Compare two directories",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "path1": {
                        "type": "string",
                        "description": "First directory"
                    },
                    "path2": {
                        "type": "string",
                        "description": "Second directory"
                    }
                },
                "required": ["path1", "path2"]
            }
        }),
        json!({
            "name": "sse",
            "description": "Watch directory with Server-Sent Events",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "path": {
                        "type": "string",
                        "description": "Path to watch"
                    },
                    "format": {
                        "type": "string",
                        "description": "Output format"
                    },
                    "heartbeat_interval": {
                        "type": "integer",
                        "description": "Heartbeat interval in seconds"
                    }
                },
                "required": ["path"]
            }
        }),
        json!({
            "name": "feedback",
            "description": "Submit feedback, request tools, or check updates",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "operation": {
                        "type": "string",
                        "enum": ["submit", "request_tool", "check_updates"],
                        "description": "Feedback operation"
                    },
                    "category": {
                        "type": "string",
                        "description": "Feedback category"
                    },
                    "title": {
                        "type": "string",
                        "description": "Feedback title"
                    },
                    "description": {
                        "type": "string",
                        "description": "Detailed description"
                    }
                },
                "required": ["operation"]
            }
        }),
        json!({
            "name": "server_info",
            "description": "Get Smart Tree server information and capabilities",
            "inputSchema": {
                "type": "object",
                "properties": {},
                "required": []
            }
        }),
        json!({
            "name": "verify_permissions",
            "description": "Verify permissions for a path",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "path": {
                        "type": "string",
                        "description": "Path to verify"
                    }
                },
                "required": ["path"]
            }
        }),
        json!({
            "name": "project_context_dump",
            "description": "📦 FULL PROJECT CONTEXT - Get a complete, token-efficient project dump for AI assistants in ONE CALL! Includes directory tree, key files, git info, with configurable compression.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "path": {
                        "type": "string",
                        "description": "Path to the project root"
                    },
                    "max_depth": {
                        "type": "integer",
                        "description": "Maximum directory depth (1-20, default: 5)"
                    },
                    "max_files": {
                        "type": "integer",
                        "description": "Maximum files to include (10-1000, default: 100)"
                    },
                    "include_content": {
                        "type": "boolean",
                        "description": "Include contents of key files (default: false)"
                    },
                    "compression": {
                        "type": "string",
                        "enum": ["auto", "marqant", "summary-ai", "quantum"],
                        "description": "Compression mode (default: auto = summary-ai)"
                    },
                    "token_budget": {
                        "type": "integer",
                        "description": "Token budget warning threshold (default: 10000)"
                    },
                    "include_git": {
                        "type": "boolean",
                        "description": "Include git status info (default: true)"
                    },
                    "key_files_only": {
                        "type": "boolean",
                        "description": "Only show key project files (default: false)"
                    }
                },
                "required": ["path"]
            }
        }),
        json!({
            "name": "ask_user",
            "description": "🗣️ Ask the human user a question and wait for their answer via the Smart Tree web dashboard. Ideal for clarifying requirements, getting explicit permission, or prompting for input without filling the chat log.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "question": {
                        "type": "string",
                        "description": "The question or prompt to ask the user"
                    }
                },
                "required": ["question"]
            }
        }),
    ]
}

/// Handle hooks tool operations
async fn handle_hooks(params: Option<Value>, _ctx: Arc<McpContext>) -> Result<Value> {
    let params = params.unwrap_or(json!({}));
    let operation = params["operation"]
        .as_str()
        .ok_or_else(|| anyhow::anyhow!("Missing operation parameter"))?;

    match operation {
        "list" => super::hook_tools::list_hooks(params).await,
        "set" => super::hook_tools::set_hook(params).await,
        "remove" => super::hook_tools::remove_hook(params).await,
        "test" => super::hook_tools::test_hook(params).await,
        "get_commands" => super::hook_tools::get_hook_commands(params).await,
        _ => Err(anyhow::anyhow!("Unknown hooks operation: {}", operation)),
    }
}

/// Tool dispatcher for consolidated tools
pub async fn dispatch_consolidated_tool(
    name: &str,
    params: Option<Value>,
    ctx: Arc<McpContext>,
) -> Result<Value> {
    match name {
        "find" => handle_find(params, ctx).await,
        "analyze" => handle_analyze(params, ctx).await,
        "search" => handle_search(params, ctx).await,
        "overview" => handle_overview(params, ctx).await,
        "edit" => handle_edit(params, ctx).await,
        "history" => handle_history(params, ctx).await,
        "context" => handle_context(params, ctx).await,
        "memory" => handle_memory(params, ctx).await,
        "compare" => handle_compare(params, ctx).await,
        "sse" => handle_sse(params, ctx).await,
        "feedback" => handle_feedback(params, ctx).await,
        "server_info" => {
            super::tools::handle_tools_call(
                json!({ "name": "server_info", "arguments": params }),
                ctx,
            )
            .await
        }
        "verify_permissions" => {
            super::tools::handle_tools_call(
                json!({ "name": "verify_permissions", "arguments": params }),
                ctx,
            )
            .await
        }
        "hooks" => handle_hooks(params, ctx).await,
        "unified_watcher" => {
            super::unified_watcher::handle_unified_watcher(params.unwrap_or(json!({})), ctx).await
        }
        // 📖 Smart read tool with AST-aware compression
        "read" => {
            super::tools::handle_tools_call(json!({ "name": "read", "arguments": params }), ctx)
                .await
        }
        // 📦 Full project context dump for AI assistants
        "project_context_dump" => {
            super::tools::handle_tools_call(
                json!({ "name": "project_context_dump", "arguments": params }),
                ctx,
            )
            .await
        }
        "ask_user" => {
            super::tools::handle_tools_call(
                json!({ "name": "ask_user", "arguments": params }),
                ctx,
            )
            .await
        }
        _ => Err(anyhow::anyhow!("Unknown tool: {}", name)),
    }
}