Skip to main content

deepseek/agent/builtin_tools/
mod.rs

1//! Built-in tools — same names and rough semantics as the Claude Agent SDK
2//! built-ins. The `builtin-tools` feature gives you Read/Write/Edit/Glob/
3//! Grep/Bash. The `scheduler` feature adds CronCreate/CronList/CronDelete/
4//! Monitor.
5
6pub mod bash;
7pub mod edit;
8pub mod glob;
9pub mod grep;
10pub mod read;
11pub mod write;
12
13pub use bash::BashTool;
14pub use edit::EditTool;
15pub use glob::GlobTool;
16pub use grep::GrepTool;
17pub use read::ReadTool;
18pub use write::WriteTool;
19
20#[cfg(feature = "scheduler")]
21pub mod cron_create;
22#[cfg(feature = "scheduler")]
23pub mod cron_delete;
24#[cfg(feature = "scheduler")]
25pub mod cron_list;
26#[cfg(feature = "scheduler")]
27pub mod monitor;
28
29#[cfg(feature = "scheduler")]
30pub use cron_create::CronCreateTool;
31#[cfg(feature = "scheduler")]
32pub use cron_delete::CronDeleteTool;
33#[cfg(feature = "scheduler")]
34pub use cron_list::CronListTool;
35#[cfg(feature = "scheduler")]
36pub use monitor::MonitorTool;
37
38use super::tool::Tool;
39
40/// Convenience: vector of all built-ins that don't need shared state.
41///
42/// With just `builtin-tools`: Read/Write/Edit/Glob/Grep/Bash.
43/// With `scheduler` also enabled: adds Monitor (the cron tools need a
44/// scheduler — call [`default_tools_with_scheduler`] for the full set).
45pub fn default_tools() -> Vec<Box<dyn Tool>> {
46    let mut v: Vec<Box<dyn Tool>> = vec![
47        Box::new(ReadTool),
48        Box::new(WriteTool),
49        Box::new(EditTool),
50        Box::new(GlobTool),
51        Box::new(GrepTool),
52        Box::new(BashTool),
53    ];
54    #[cfg(feature = "scheduler")]
55    v.push(Box::new(MonitorTool));
56    v
57}
58
59/// All ten built-in tools wired against the supplied scheduler. Available
60/// only with the `scheduler` feature.
61#[cfg(feature = "scheduler")]
62pub fn default_tools_with_scheduler(
63    scheduler: std::sync::Arc<std::sync::Mutex<crate::agent::scheduler::Scheduler>>,
64) -> Vec<Box<dyn Tool>> {
65    vec![
66        Box::new(ReadTool),
67        Box::new(WriteTool),
68        Box::new(EditTool),
69        Box::new(GlobTool),
70        Box::new(GrepTool),
71        Box::new(BashTool),
72        Box::new(MonitorTool),
73        Box::new(CronCreateTool::new(scheduler.clone())),
74        Box::new(CronListTool::new(scheduler.clone())),
75        Box::new(CronDeleteTool::new(scheduler)),
76    ]
77}