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
compact: Tool description compactionplanning_workflow: Plan approval artifacts and workflow stateplanning_task_tracker,task_tracker,task_tracking: Task trackersread_file: File reading with line rangessession_tool_catalog: Per-session tool catalog projection
§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::TurnDiffTracker;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::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§
- Exec
Policy Amendment - A proposed amendment to the execution policy.
- Freeform
Tool - Freeform
Tool Format - Reject
Config - Fine-grained rejection controls for approval prompts.
- Responses
ApiTool
Enums§
- Additional
Properties - AskFor
Approval - Policy for when to ask for approval before executing commands.
- Exec
Approval Requirement - Requirement for approval before executing a command.
- Sandbox
Permissions - Fine-grained permissions for sandbox operations.
- Tool
Profile - Model-facing tool profile for a session.