pub struct ToolIdentityPolicy {
pub operation_arg: Option<&'static str>,
pub target: Option<TargetExtractor>,
pub args_key_fn: Option<ArgsKeyFn>,
}Expand description
Typed identity contract for one tool. All fields default to None
— a tool that does not override identity_policy is treated as
“single operation, no persistent target, opaque args” (matches the
historical fall-through behavior for unknown tools).
Fields§
§operation_arg: Option<&'static str>Top-level argument whose string value names the operation when
the tool dispatches on action / mode / similar. The
detector pairs this with tool_name so two distinct operations
of the same tool do not collide into one repeat signature.
target: Option<TargetExtractor>How to extract the persistent target string. None means the
tool has no persistent target — every call is identified by
its full args.
args_key_fn: Option<ArgsKeyFn>Tool-specific full-identity extractor. Overrides the default
target={tool}:{target} composition when set.
Implementations§
Source§impl ToolIdentityPolicy
impl ToolIdentityPolicy
pub const fn new() -> Self
Sourcepub const fn with_operation_arg(self, arg: &'static str) -> Self
pub const fn with_operation_arg(self, arg: &'static str) -> Self
Declare the top-level argument that discriminates operations
for this tool (e.g. "action" for office, shell, plan).
Sourcepub const fn with_target_arg(self, arg: &'static str) -> Self
pub const fn with_target_arg(self, arg: &'static str) -> Self
Declare a top-level string argument as the persistent target
(e.g. "path" for file_*, "url" for browser_navigate).
Sourcepub const fn with_target_fn(self, f: TargetFn) -> Self
pub const fn with_target_fn(self, f: TargetFn) -> Self
Provide a tool-specific target extractor for composite targets
(e.g. shell’s action:command-prefix).
Sourcepub const fn with_args_key_fn(self, f: ArgsKeyFn) -> Self
pub const fn with_args_key_fn(self, f: ArgsKeyFn) -> Self
Provide a tool-specific full-identity extractor. Use this only
when the identity is more than target={tool}:{target} — e.g.
plan’s action+status+next_phase_id composite.
Trait Implementations§
Source§impl Clone for ToolIdentityPolicy
impl Clone for ToolIdentityPolicy
Source§fn clone(&self) -> ToolIdentityPolicy
fn clone(&self) -> ToolIdentityPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more