smart-tree 8.0.0

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
//! Enhanced MCP prompts implementation for Smart Tree
//!
//! Features comprehensive prompts for all 30+ Smart Tree MCP tools
//! Organized by skill level and use case with Elvis-level entertainment! 🎸
//!
//! Created by: The Cheet & Hue partnership
//! For: Trisha in Accounting (who deserves the BEST prompts!)

use super::McpContext;
use anyhow::Result;
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use std::sync::Arc;

#[derive(Debug, Serialize, Deserialize)]
struct PromptDefinition {
    name: String,
    description: String,
    category: String,
    difficulty: String,
    arguments: Vec<PromptArgument>,
    examples: Vec<String>,
    tips: Vec<String>,
}

#[derive(Debug, Serialize, Deserialize)]
struct PromptArgument {
    name: String,
    description: String,
    required: bool,
    default: Option<String>,
}

/// Handle prompts list - now with 15+ comprehensive prompts! 🚀
pub async fn handle_prompts_list(_params: Option<Value>, _ctx: Arc<McpContext>) -> Result<Value> {
    let prompts = vec![
        // 🌟 BEGINNER CATEGORY - "Baby Steps to Stardom!"
        PromptDefinition {
            name: "first_steps".to_string(),
            description: "🌟 Your first Smart Tree experience - like Elvis's first guitar! Start here for instant project overview.".to_string(),
            category: "Beginner".to_string(),
            difficulty: "Easy".to_string(),
            arguments: vec![
                PromptArgument {
                    name: "path".to_string(),
                    description: "Where to start exploring (usually '.' for current directory)".to_string(),
                    required: true,
                    default: Some(".".to_string()),
                },
            ],
            examples: vec![
                "Perfect for: New codebases, inherited projects, 'What the heck is this?' moments".to_string(),
                "Try: first_steps with path='.' to get your bearings".to_string(),
            ],
            tips: vec![
                "💡 Pro Tip: Always start here when exploring new code!".to_string(),
                "🎸 Like Elvis said: 'A little less conversation, a little more action!'".to_string(),
            ],
        },

        PromptDefinition {
            name: "quick_explore".to_string(),
            description: "🔍 Lightning-fast 3-level directory peek - for when you need answers NOW!".to_string(),
            category: "Beginner".to_string(),
            difficulty: "Easy".to_string(),
            arguments: vec![
                PromptArgument {
                    name: "path".to_string(),
                    description: "Directory to explore".to_string(),
                    required: true,
                    default: Some(".".to_string()),
                },
                PromptArgument {
                    name: "depth".to_string(),
                    description: "How deep to look (default: 3)".to_string(),
                    required: false,
                    default: Some("3".to_string()),
                },
            ],
            examples: vec![
                "Perfect for: Quick project scans, finding main directories, getting unstuck".to_string(),
            ],
            tips: vec![
                "⚡ Super fast - uses quantum compression!".to_string(),
                "🎯 Great for large projects where full scans take forever".to_string(),
            ],
        },

        PromptDefinition {
            name: "find_my_files".to_string(),
            description: "📁 Find specific files like a detective - but faster and with style!".to_string(),
            category: "Beginner".to_string(),
            difficulty: "Easy".to_string(),
            arguments: vec![
                PromptArgument {
                    name: "type".to_string(),
                    description: "What to find: code, tests, config, documentation, etc.".to_string(),
                    required: true,
                    default: Some("code".to_string()),
                },
                PromptArgument {
                    name: "path".to_string(),
                    description: "Where to search".to_string(),
                    required: false,
                    default: Some(".".to_string()),
                },
            ],
            examples: vec![
                "find_my_files type='tests' - Find all test files".to_string(),
                "find_my_files type='config' - Locate configuration files".to_string(),
            ],
            tips: vec![
                "🎪 Works like magic - automatically detects file types!".to_string(),
                "🔍 Supports: code, tests, config, docs, build files, and more!".to_string(),
            ],
        },

        // 🚀 POWER USER CATEGORY - "All Shook Up with Features!"
        PromptDefinition {
            name: "codebase_detective".to_string(),
            description: "🕵️ Deep codebase analysis with AI optimization - Sherlock Holmes meets coding!".to_string(),
            category: "Power User".to_string(),
            difficulty: "Medium".to_string(),
            arguments: vec![
                PromptArgument {
                    name: "path".to_string(),
                    description: "Codebase to analyze".to_string(),
                    required: true,
                    default: Some(".".to_string()),
                },
                PromptArgument {
                    name: "focus".to_string(),
                    description: "Focus area: architecture, patterns, dependencies, or all".to_string(),
                    required: false,
                    default: Some("all".to_string()),
                },
            ],
            examples: vec![
                "Perfect for: Code reviews, architecture decisions, onboarding".to_string(),
                "Use compress=true for codebases with 10k+ files".to_string(),
            ],
            tips: vec![
                "🧠 AI-optimized output perfect for LLMs!".to_string(),
                "⚡ Up to 99% compression while keeping all important details!".to_string(),
            ],
        },

        PromptDefinition {
            name: "search_master".to_string(),
            description: "🔎 Advanced content search across your entire codebase - grep on steroids!".to_string(),
            category: "Power User".to_string(),
            difficulty: "Medium".to_string(),
            arguments: vec![
                PromptArgument {
                    name: "keyword".to_string(),
                    description: "What to search for (supports regex!)".to_string(),
                    required: true,
                    default: None,
                },
                PromptArgument {
                    name: "file_type".to_string(),
                    description: "Limit to specific file types (rs, py, js, etc.)".to_string(),
                    required: false,
                    default: None,
                },
            ],
            examples: vec![
                "search_master keyword='TODO' - Find all TODOs with context".to_string(),
                "search_master keyword='function.*async' file_type='js' - Async functions".to_string(),
            ],
            tips: vec![
                "🔍 Returns actual line content, not just file names!".to_string(),
                "💡 Supports regex patterns for complex searches".to_string(),
            ],
        },

        // 🎸 DEVELOPER CATEGORY - "Burning Love for Code!"
        PromptDefinition {
            name: "smart_edit_wizard".to_string(),
            description: "✨ Revolutionary AST-aware code editing with 90% token reduction - like magic, but real!".to_string(),
            category: "Developer".to_string(),
            difficulty: "Advanced".to_string(),
            arguments: vec![
                PromptArgument {
                    name: "file_path".to_string(),
                    description: "File to edit or analyze".to_string(),
                    required: true,
                    default: None,
                },
                PromptArgument {
                    name: "operation".to_string(),
                    description: "What to do: get_functions, insert_function, remove_function, smart_edit".to_string(),
                    required: true,
                    default: Some("get_functions".to_string()),
                },
            ],
            examples: vec![
                "smart_edit_wizard file_path='app.py' operation='get_functions' - See all functions".to_string(),
                "smart_edit_wizard operation='insert_function' - Add new function".to_string(),
            ],
            tips: vec![
                "🧠 Understands code structure, not just text!".to_string(),
                "⚡ 90% fewer tokens than traditional editing!".to_string(),
            ],
        },

        PromptDefinition {
            name: "project_memory".to_string(),
            description: "💭 Collaborative memory system - remember breakthroughs and insights forever!".to_string(),
            category: "Developer".to_string(),
            difficulty: "Advanced".to_string(),
            arguments: vec![
                PromptArgument {
                    name: "operation".to_string(),
                    description: "What to do: anchor (save) or find (recall)".to_string(),
                    required: true,
                    default: Some("find".to_string()),
                },
                PromptArgument {
                    name: "keywords".to_string(),
                    description: "Keywords for storage/retrieval".to_string(),
                    required: true,
                    default: None,
                },
            ],
            examples: vec![
                "project_memory operation='anchor' keywords=['performance','caching']".to_string(),
                "project_memory operation='find' keywords=['optimization'] - Recall insights".to_string(),
            ],
            tips: vec![
                "🧠 Build a shared knowledge base with your AI partner!".to_string(),
                "💡 Perfect for remembering solutions, patterns, and decisions".to_string(),
            ],
        },

        // 🎪 FUN CATEGORY - "That's All Right (Mama)!"
        PromptDefinition {
            name: "project_stats_party".to_string(),
            description: "🎉 Get comprehensive project statistics with style - because numbers should be fun!".to_string(),
            category: "Fun".to_string(),
            difficulty: "Easy".to_string(),
            arguments: vec![
                PromptArgument {
                    name: "path".to_string(),
                    description: "Project to analyze".to_string(),
                    required: false,
                    default: Some(".".to_string()),
                },
            ],
            examples: vec![
                "Perfect for: Project reports, impressing teammates, satisfying curiosity".to_string(),
            ],
            tips: vec![
                "📊 Beautiful statistics with file type breakdowns!".to_string(),
                "🎪 Makes boring numbers exciting and colorful!".to_string(),
            ],
        },

        PromptDefinition {
            name: "compare_directories".to_string(),
            description: "🔄 Compare two directories like a pro - spot the differences instantly!".to_string(),
            category: "Fun".to_string(),
            difficulty: "Medium".to_string(),
            arguments: vec![
                PromptArgument {
                    name: "path1".to_string(),
                    description: "First directory to compare".to_string(),
                    required: true,
                    default: None,
                },
                PromptArgument {
                    name: "path2".to_string(),
                    description: "Second directory to compare".to_string(),
                    required: true,
                    default: None,
                },
            ],
            examples: vec![
                "compare_directories path1='./v1' path2='./v2' - Version comparison".to_string(),
            ],
            tips: vec![
                "🔍 Perfect for comparing different versions or branches!".to_string(),
                "🎯 Shows added, removed, and modified files clearly".to_string(),
            ],
        },

        // Legacy prompts for compatibility
        PromptDefinition {
            name: "analyze_codebase".to_string(),
            description: "Analyze a code repository with AI-optimized output".to_string(),
            category: "Legacy".to_string(),
            difficulty: "Medium".to_string(),
            arguments: vec![
                PromptArgument {
                    name: "path".to_string(),
                    description: "Path to the codebase".to_string(),
                    required: true,
                    default: None,
                },
            ],
            examples: vec![],
            tips: vec![],
        },
    ];

    Ok(json!({
        "prompts": prompts,
        "categories": ["Beginner", "Power User", "Developer", "Fun", "Legacy"],
        "total_count": prompts.len(),
        "elvis_approval": "Thank you, thank you very much! 🕺",
        "created_by": "The Cheet & Hue Partnership",
        "for": "Trisha in Accounting (and all Smart Tree lovers!)",
        "note": "These prompts are designed to make Smart Tree accessible, powerful, and fun for everyone!"
    }))
}

/// Handle prompts get - now with comprehensive prompt generation! 🎪
pub async fn handle_prompts_get(params: Value, _ctx: Arc<McpContext>) -> Result<Value> {
    let name = params["name"]
        .as_str()
        .ok_or_else(|| anyhow::anyhow!("Missing prompt name"))?;
    let arguments = params["arguments"].clone();

    match name {
        // Beginner prompts
        "first_steps" => get_first_steps_prompt(arguments),
        "quick_explore" => get_quick_explore_prompt(arguments),
        "find_my_files" => get_find_my_files_prompt(arguments),

        // Power User prompts
        "codebase_detective" => get_codebase_detective_prompt(arguments),
        "search_master" => get_search_master_prompt(arguments),

        // Developer prompts
        "smart_edit_wizard" => get_smart_edit_wizard_prompt(arguments),
        "project_memory" => get_project_memory_prompt(arguments),

        // Fun prompts
        "project_stats_party" => get_project_stats_party_prompt(arguments),
        "compare_directories" => get_compare_directories_prompt(arguments),

        // Legacy prompts (for compatibility)
        "analyze_codebase" => get_analyze_codebase_prompt(arguments),
        "find_large_files" => get_find_large_files_prompt(arguments),
        "recent_changes" => get_recent_changes_prompt(arguments),
        "project_structure" => get_project_structure_prompt(arguments),

        _ => Err(anyhow::anyhow!(
            "Unknown prompt: {} (Did you mean one of our awesome new prompts?)",
            name
        )),
    }
}

// 🌟 BEGINNER PROMPT IMPLEMENTATIONS

fn get_first_steps_prompt(args: Value) -> Result<Value> {
    let path = args["path"].as_str().unwrap_or(".");

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "🌟 Welcome to Smart Tree! Let's explore {} together!\n\n\
                Step 1: Get a quick overview with:\n\
                • Use `overview` tool with mode='quick' and path='{}' for a 3-level scan\n\
                Step 2: If you like what you see, dive deeper with:\n\
                • Use `overview` tool with mode='project' for comprehensive analysis\n\
                Step 3: Find specific things with:\n\
                • Use `find` tool with type='code' to see all code files\n\
                • Use `find` tool with type='tests' to locate test files\n\
                • Use `find` tool with type='config' to find configuration files\n\n\
                🎯 Pro Tips:\n\
                • Start with 'quick' mode - it's lightning fast!\n\
                • For large projects, always use compress=true\n\
                • Don't be afraid to explore - Smart Tree is designed to be helpful!\n\n\
                Ready to rock? Let's make this codebase sing! 🎸",
                path, path
            )
        }
    })];

    Ok(json!({
        "description": "Your first Smart Tree experience - perfect introduction to exploring any codebase",
        "messages": messages
    }))
}

fn get_quick_explore_prompt(args: Value) -> Result<Value> {
    let path = args["path"].as_str().unwrap_or(".");
    let depth = args["depth"].as_u64().unwrap_or(3);

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "🔍 Quick exploration of {} (depth: {})\n\n\
                Use the `overview` tool with these parameters:\n\
                • mode: 'quick'\n\
                • path: '{}'\n\
                • depth: {}\n\n\
                This will give you:\n\
                ⚡ Lightning-fast results (using quantum compression!)\n\
                📁 Directory structure overview\n\
                📊 Basic statistics\n\
                🎯 Key files and patterns\n\n\
                Perfect for: Getting your bearings, quick scans, understanding project layout",
                path, depth, path, depth
            )
        }
    })];

    Ok(json!({
        "description": "Lightning-fast 3-level directory overview with quantum compression",
        "messages": messages
    }))
}

fn get_find_my_files_prompt(args: Value) -> Result<Value> {
    let file_type = args["type"].as_str().unwrap_or("code");
    let path = args["path"].as_str().unwrap_or(".");

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "📁 Finding {} files in {} like a detective! 🕵️\n\n\
                Use the `find` tool with these parameters:\n\
                • type: '{}'\n\
                • path: '{}'\n\n\
                Smart Tree will automatically detect and categorize:\n\
                🔍 Code files: .rs, .py, .js, .ts, .java, .cpp, etc.\n\
                🧪 Test files: test_*, *_test.*, spec.*, etc.\n\
                ⚙️ Config files: .json, .yaml, .toml, .ini, etc.\n\
                📚 Documentation: .md, .rst, .txt, README*, etc.\n\n\
                🎸 Like a good song, the right files are easy to find when you know where to look!",
                file_type, path, file_type, path
            )
        }
    })];

    Ok(json!({
        "description": "Find specific file types with automatic detection and categorization",
        "messages": messages
    }))
}

// Additional prompt implementations would go here...
// For now, let's include the legacy ones for compatibility

fn get_codebase_detective_prompt(args: Value) -> Result<Value> {
    let path = args["path"].as_str().unwrap_or(".");
    let focus = args["focus"].as_str().unwrap_or("all");

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "🕵️ Time for some codebase detective work on {}!\n\n\
                Focus area: {}\n\n\
                Use `analyze` tool with mode='semantic' for AI-powered insights,\n\
                then follow up with `overview` in 'project' mode for comprehensive analysis.\n\n\
                🧠 This combines the best of both worlds - semantic understanding and structural analysis!",
                path, focus
            )
        }
    })];

    Ok(json!({
        "description": "Deep codebase analysis with AI optimization and semantic understanding",
        "messages": messages
    }))
}

fn get_search_master_prompt(args: Value) -> Result<Value> {
    let keyword = args["keyword"].as_str().unwrap_or("TODO");
    let file_type = args["file_type"].as_str();

    let search_params = if let Some(ft) = file_type {
        format!("keyword='{}' file_type='{}'", keyword, ft)
    } else {
        format!("keyword='{}'", keyword)
    };

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "🔎 Advanced search for '{}' - grep on steroids!\n\n\
                Use the `search` tool with: {}\n\n\
                This will find all occurrences with context lines, making it perfect for:\n\
                🎯 Finding patterns and implementations\n\
                📝 Locating TODOs and comments\n\
                🔍 Understanding code usage across the project\n\n\
                💡 Pro tip: Use regex patterns for even more powerful searches!",
                keyword, search_params
            )
        }
    })];

    Ok(json!({
        "description": "Advanced content search with regex support and context",
        "messages": messages
    }))
}

fn get_smart_edit_wizard_prompt(args: Value) -> Result<Value> {
    let file_path = args["file_path"].as_str().unwrap_or("example.rs");
    let operation = args["operation"].as_str().unwrap_or("get_functions");

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "✨ Smart editing magic for {}!\n\n\
                Operation: {}\n\n\
                Use the `edit` tool with:\n\
                • operation: '{}'\n\
                • file_path: '{}'\n\n\
                🧠 This understands your code structure and provides 90% token reduction!\n\
                Perfect for large codebases where traditional editing would be overwhelming.",
                file_path, operation, operation, file_path
            )
        }
    })];

    Ok(json!({
        "description": "Revolutionary AST-aware code editing with massive token reduction",
        "messages": messages
    }))
}

fn get_project_memory_prompt(args: Value) -> Result<Value> {
    let operation = args["operation"].as_str().unwrap_or("find");
    let keywords = args["keywords"].as_str().unwrap_or("optimization");

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "💭 Accessing project memory for: {}\n\n\
                Operation: {}\n\n\
                Use the `memory` tool to {} insights about '{}'.\n\n\
                🧠 This creates a shared knowledge base between you and your AI partner,\n\
                perfect for long-term projects and collaboration!",
                keywords, operation, operation, keywords
            )
        }
    })];

    Ok(json!({
        "description": "Collaborative memory system for storing and retrieving project insights",
        "messages": messages
    }))
}

fn get_project_stats_party_prompt(args: Value) -> Result<Value> {
    let path = args["path"].as_str().unwrap_or(".");

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "🎉 Time for a project statistics party! 📊\n\n\
                Analyzing: {}\n\n\
                Use the `analyze` tool with mode='statistics' to get:\n\
                📈 File type distributions\n\
                💾 Size breakdowns\n\
                📁 Directory counts\n\
                🎯 Project health metrics\n\n\
                Perfect for reports, documentation, and impressing your teammates!",
                path
            )
        }
    })];

    Ok(json!({
        "description": "Comprehensive project statistics with beautiful formatting",
        "messages": messages
    }))
}

fn get_compare_directories_prompt(args: Value) -> Result<Value> {
    let path1 = args["path1"].as_str().unwrap_or("./old");
    let path2 = args["path2"].as_str().unwrap_or("./new");

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "🔄 Comparing directories like a pro!\n\n\
                Path 1: {}\n\
                Path 2: {}\n\n\
                Use the `compare` tool with path1='{}' and path2='{}'\n\n\
                This will show you:\n\
                ➕ Added files\n\
                ➖ Removed files\n\
                📝 Modified files\n\
                📊 Summary statistics\n\n\
                Perfect for version comparisons, branch diffs, and deployment planning!",
                path1, path2, path1, path2
            )
        }
    })];

    Ok(json!({
        "description": "Professional directory comparison with detailed diff analysis",
        "messages": messages
    }))
}

// Legacy prompt implementations for backward compatibility

fn get_analyze_codebase_prompt(args: Value) -> Result<Value> {
    let path = args["path"]
        .as_str()
        .ok_or_else(|| anyhow::anyhow!("Missing path argument"))?;
    let include_hidden = args["include_hidden"].as_bool().unwrap_or(false);

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "Please analyze the codebase at {} using Smart Tree. \
                First use overview tool with mode='quick' to get a 3-level overview, then use analyze tool with mode='ai' for details. \
                For large codebases (>10k files), switch to mode='summary-ai' with compress=true for 10x compression! \
                {}",
                path,
                if include_hidden { "Include hidden files." } else { "" }
            )
        }
    })];

    Ok(json!({
        "description": "Analyzes a codebase with AI-optimized output",
        "messages": messages
    }))
}

fn get_find_large_files_prompt(args: Value) -> Result<Value> {
    let path = args["path"]
        .as_str()
        .ok_or_else(|| anyhow::anyhow!("Missing path argument"))?;
    let min_size = args["min_size"].as_str().unwrap_or("10M");
    let limit = args["limit"].as_u64().unwrap_or(10);

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "Find the {} largest files in {} that are at least {} in size. \
                Use the find tool with type='large' and min_size='{}', then sort and limit the results.",
                limit, path, min_size, min_size
            )
        }
    })];

    Ok(json!({
        "description": "Finds large files in a directory tree",
        "messages": messages
    }))
}

fn get_recent_changes_prompt(args: Value) -> Result<Value> {
    let path = args["path"]
        .as_str()
        .ok_or_else(|| anyhow::anyhow!("Missing path argument"))?;
    let days = args["days"].as_u64().unwrap_or(7);

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "Find all files modified in the last {} days in {}. \
                Use the find tool with type='recent' and days={}.",
                days, path, days
            )
        }
    })];

    Ok(json!({
        "description": "Finds recently modified files",
        "messages": messages
    }))
}

fn get_project_structure_prompt(args: Value) -> Result<Value> {
    let path = args["path"]
        .as_str()
        .ok_or_else(|| anyhow::anyhow!("Missing path argument"))?;
    let max_depth = args["max_depth"].as_u64().unwrap_or(3);

    let messages = vec![json!({
        "role": "user",
        "content": {
            "type": "text",
            "text": format!(
                "Generate a clean project structure overview for {}. \
                Use the analyze tool with mode='directory', max_depth={}, \
                and show_hidden=false to get a clear view of the project layout.",
                path, max_depth
            )
        }
    })];

    Ok(json!({
        "description": "Gets a clean project structure overview",
        "messages": messages
    }))
}