Forge documentation
Library referenceRust

forge-toolbelt

First-class default toolbelt for Forge SDK agents — search, crawl, code intelligence, file ops, shell, memory hooks

First-class default toolbelt for Forge SDK agents — search, crawl, code intelligence, file ops, shell, memory hooks

Package contract

FieldValue
Languagerust
Source version0.2.0
Manifestforge-rs/crates/forge-toolbelt/Cargo.toml
Source files6
EvidenceSource reference; registry publication and runtime conformance are separate checks

Import boundary

use forge_toolbelt;

Use a source checkout or your verified private registry. Manifest coordinates identify the package; they do not establish that a public registry release exists.

Crate boundary

The following entries are taken from src/lib.rs. Feature conditions in the exact source still apply.

pub mod config;

pub mod error;

pub mod file_ops;

pub mod shell;

pub mod utility;

pub mod prelude;

pub use crate::config::{ShellPolicy, ToolGroup, ToolbeltConfig};

pub use crate::register_toolbelt;

Source reference

Download package reference JSON. Each original source file and generated declaration artifact has its own SHA-256 digest. Function bodies and constant values are omitted from downloads. These are source declaration inventories, not compiler-resolved rustdoc, TypeDoc, DocC, or Dokka output. Private modules can contain public declarations that are not reachable through the package boundary; consult the entry point before importing.

config.rs

Read declaration text · 19 declaration entries

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ToolGroup {
    /// Search tools (OneSearch integration): search, search_images, extract_content,
    /// crawl_site, map_site, summarize_text.
    Search,
    /// Web substrate tools: web_fetch, web_parse, web_extract, etc.
    Web,
    /// Codebase intelligence: repo_structure, dependency_graph, rank_files,
    /// predict_impact, assemble_context.
    Codebase,
    /// File operations: file_read, file_stat, file_type.
    FileOps,
    /// Shell execution (policy-gated): shell_exec.
    Shell,
    /// Utility tools: current_time, uuid_generate.
    Utility,
}

pub fn as_str(&self) -> &'static str;

pub fn all() -> &'static [ToolGroup];

#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ShellPolicy {
    /// Shell execution is completely disabled.
    Disabled,
    /// Only read-only commands are allowed (ls, cat, find, grep, etc.).
    #[default]
    ReadOnly,
    /// Read and write commands are allowed, but destructive operations
    /// (rm, chmod, chown, etc.) require approval.
    ReadWrite,
    /// All commands are allowed. Use with extreme caution.
    Unrestricted,
}

pub fn allows_reads(&self) -> bool;

pub fn allows_writes(&self) -> bool;

pub fn allows_destructive(&self) -> bool;

#[derive(Debug, Clone)]
pub struct ToolbeltConfig {

}

pub fn builder() -> ToolbeltConfigBuilder;

pub fn is_enabled(&self, group: ToolGroup) -> bool;

pub fn search_config(&self) -> &SearchConfig;

pub fn shell_policy(&self) -> &ShellPolicy;

pub fn enabled_groups(&self) -> Vec<ToolGroup>;

pub struct ToolbeltConfigBuilder {

}

pub fn enable(mut self, group: ToolGroup) -> Self;

pub fn enable_all(mut self) -> Self;

pub fn search_config(mut self, config: SearchConfig) -> Self;

pub fn shell_policy(mut self, policy: ShellPolicy) -> Self;

pub fn build(self) -> ToolbeltConfig;

error.rs

Read declaration text · 2 declaration entries

#[derive(Debug, Error)]
pub enum ToolbeltError {
    /// A tool group is not enabled in the current configuration.
    #[error("tool group '{group}' is not enabled in the toolbelt configuration")]
    GroupNotEnabled {
        /// The disabled group.
        group: String,
    },

    /// Shell command execution was denied by policy.
    #[error("shell command '{command}' denied by policy '{policy}': {reason}")]
    ShellDenied {
        /// The command that was denied.
        command: String,
        /// The active policy.
        policy: String,
        /// Why the command was denied.
        reason: String,
    },

    /// File operation failed.
    #[error("file operation failed on '{path}': {reason}")]
    FileOpFailed {
        /// The file path.
        path: String,
        /// What went wrong.
        reason: String,
    },
}

pub type ToolbeltResult<T> = Result<T, ToolbeltError>;

file_ops.rs

Read declaration text · 1 declaration entries

pub fn register_file_ops_tools(registry: &mut ToolRegistry) -> Result<(), ForgeToolError>;

lib.rs

Read declaration text · 9 declaration entries

pub mod config;

pub mod error;

pub mod file_ops;

pub mod shell;

pub mod utility;

pub fn register_toolbelt(
    registry: &mut ToolRegistry,
    config: &ToolbeltConfig,
) -> Result<(), ForgeToolError>;

pub mod prelude;

pub use crate::config::{ShellPolicy, ToolGroup, ToolbeltConfig};

pub use crate::register_toolbelt;

shell.rs

Read declaration text · 1 declaration entries

pub fn register_shell_tools(
    registry: &mut ToolRegistry,
    policy: &ShellPolicy,
) -> Result<(), ForgeToolError>;

utility.rs

Read declaration text · 1 declaration entries

pub fn register_utility_tools(registry: &mut ToolRegistry) -> Result<(), ForgeToolError>;

Continue

On this page