Skip to main content

ares_tools/
config.rs

1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3
4// ============= Tool Configuration =============
5
6/// Tool configuration for built-in or custom tools.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct ToolConfig {
9    /// Whether the tool is enabled (default: true).
10    #[serde(default = "default_true")]
11    pub enabled: bool,
12
13    /// Optional human-readable description of the tool.
14    #[serde(default)]
15    pub description: Option<String>,
16
17    /// Timeout in seconds for tool execution (default: 30).
18    #[serde(default = "default_tool_timeout")]
19    pub timeout_secs: u64,
20
21    /// Additional tool-specific configuration passed through.
22    #[serde(flatten)]
23    pub extra: HashMap<String, toml::Value>,
24}
25
26fn default_true() -> bool {
27    true
28}
29
30fn default_tool_timeout() -> u64 {
31    30
32}
33
34impl Default for ToolConfig {
35    fn default() -> Self {
36        Self {
37            enabled: true,
38            description: None,
39            timeout_secs: default_tool_timeout(),
40            extra: HashMap::new(),
41        }
42    }
43}