Skip to main content

Module handlers

Module handlers 

Source
Expand description

Tool handlers module

The authoritative public tool surface, name resolution, and catalog assembly live in crate::tools::registry. This module holds the handler-side types and the tool implementations that the registry and runloop build on.

The Codex-compatible execution scaffolding (router, adapter, events, apply_patch_handler, shell_handler, list_dir_handler, tool_orchestrator, orchestrator, intercept_apply_patch) was never registered as a live path and has been removed. tools::SHELL and the other command-session aliases resolve to unified_exec through tool_intent::canonical_command_session_tool_name, and the executor pipeline in crate::tools::registry owns dispatch. Do not reintroduce a parallel handler path that bypasses it.

§Key Components

  • tool_handler: Handler-side types still used by live code (ToolCallError, TurnContext, ToolSession, approval/sandbox policy wrappers)
  • sandboxing: Approval, sandbox, and runtime traits (from Codex)
  • turn_diff_tracker: Aggregates file diffs across patches in a turn

§Handlers

§Usage

ⓘ
use vtcode_core::tools::handlers::{ToolHandler, ToolInvocation, ToolOutput};

struct MyHandler;

#[async_trait::async_trait]
impl ToolHandler for MyHandler {
    fn kind(&self) -> ToolKind {
        ToolKind::Function
    }

    async fn handle(&self, invocation: ToolInvocation) -> Result<ToolOutput, ToolCallError> {
        Ok(ToolOutput::simple("Done!"))
    }
}

Re-exports§

pub use sandboxing::Approvable;
pub use sandboxing::ApprovalCtx;
pub use sandboxing::ApprovalStore;
pub use sandboxing::BoxFuture;
pub use sandboxing::CommandSpec;
pub use sandboxing::ExecEnv;
pub use sandboxing::ExecToolCallOutput;
pub use sandboxing::NetworkAccess;
pub use sandboxing::ReviewDecision;
pub use sandboxing::SandboxAttempt;
pub use sandboxing::SandboxConfig;
pub use sandboxing::SandboxManager;
pub use sandboxing::SandboxOverride;
pub use sandboxing::SandboxPolicy;
pub use sandboxing::SandboxTransformError;
pub use sandboxing::SandboxType;
pub use sandboxing::Sandboxable;
pub use sandboxing::SandboxablePreference;
pub use sandboxing::ToolCtx;
pub use sandboxing::ToolError;
pub use sandboxing::ToolRuntime;
pub use sandboxing::default_exec_approval_requirement;
pub use sandboxing::execute_env;
pub use sandboxing::with_cached_approval;
pub use turn_diff_tracker::ChangeAttribution;
pub use turn_diff_tracker::FileChange;
pub use turn_diff_tracker::FileChangeKind;
pub use turn_diff_tracker::SharedTurnDiffTracker;
pub use turn_diff_tracker::TurnDiffTracker;
pub use turn_diff_tracker::new_shared_tracker;
pub use session_tool_catalog::CatalogToolKind;
pub use session_tool_catalog::DeferredToolPolicy;
pub use session_tool_catalog::DeferredToolSearchKind;
pub use session_tool_catalog::SessionSurface;
pub use session_tool_catalog::SessionToolCatalog;
pub use session_tool_catalog::SessionToolsConfig;
pub use session_tool_catalog::ToolCatalogEntry;
pub use session_tool_catalog::ToolCatalogSource;
pub use session_tool_catalog::ToolModelCapabilities;
pub use session_tool_catalog::ToolSchemaEntry;
pub use session_tool_catalog::anthropic_native_memory_enabled_for_runtime;
pub use session_tool_catalog::deferred_tool_policy_for_runtime;
pub use planning_workflow::PlanningWorkflowState;
pub use planning_workflow::StartPlanningTool;
pub use planning_task_tracker::PlanningTaskTrackerTool;
pub use task_tracker::TaskTrackerTool;
pub use tool_handler::ApprovalPolicy;
pub use tool_handler::ConfiguredToolSpec;
pub use tool_handler::Constrained;
pub use tool_handler::ContentItem;
pub use tool_handler::DiffTracker;
pub use tool_handler::McpToolResult;
pub use tool_handler::SharedDiffTracker;
pub use tool_handler::ShellEnvironmentPolicy;
pub use tool_handler::ShellToolCallParams;
pub use tool_handler::ToolCallError;
pub use tool_handler::ToolHandler;
pub use tool_handler::ToolInvocation;
pub use tool_handler::ToolKind;
pub use tool_handler::ToolOutput;
pub use tool_handler::ToolPayload;
pub use tool_handler::ToolSession;
pub use tool_handler::ToolSpec;
pub use tool_handler::TurnContext;
pub use tool_handler::FileChange as LegacyFileChange;

Modules§

compact
Tool schema compaction utilities for session tool catalog.
planning_task_tracker
Planning workflow scoped task tracker persisted next to the active plan file.
planning_workflow
Planning workflow tools and supporting logic.
read_file
sandboxing
Shared approvals and sandboxing traits used by tool runtimes (from Codex)
session_tool_catalog
task_tracker
Task Tracker tool for structured task management during complex sessions.
task_tracking
tool_handler
Codex-compatible ToolHandler trait and types
turn_diff_tracker
Turn Diff Tracker (from Codex)

Structs§

ExecPolicyAmendment
A proposed amendment to the execution policy.
FreeformTool
FreeformToolFormat
RejectConfig
Fine-grained rejection controls for approval prompts.
ResponsesApiTool

Enums§

AdditionalProperties
AskForApproval
Policy for when to ask for approval before executing commands.
ExecApprovalRequirement
Requirement for approval before executing a command.
SandboxPermissions
Fine-grained permissions for sandbox operations.
ToolProfile
Model-facing tool profile for a session.

Type Aliases§

JsonSchema