pub trait SelfHandler {
// Required methods
fn tools(&self) -> Vec<ToolDef>;
fn handle(&mut self, name: &str, args: &Value) -> Option<(String, bool)>;
// Provided methods
fn read_resource(&mut self, _uri: &str) -> Option<(String, bool)> { ... }
fn serves_self_resources(&self) -> bool { ... }
fn take_scheduled(&mut self) -> Vec<ScheduleRequest> { ... }
fn take_subscriptions(&mut self) -> Vec<SubscriptionRequest> { ... }
}Expand description
Provides agentd’s in-process self-tools to the loop. The loop tries the
self-handler first; a None result means “not a self-tool — fall through to
MCP”.
Required Methods§
Provided Methods§
Sourcefn read_resource(&mut self, _uri: &str) -> Option<(String, bool)>
fn read_resource(&mut self, _uri: &str) -> Option<(String, bool)>
Read an agentd:// self-resource (e.g. agentd://subagent/<handle> — an
async child’s completion). A resource.read for an agentd:// URI routes
here instead of to MCP. Returns Some((content, is_error)) if this handler
serves the URI; None (the default) means it does not, and the read falls
through to MCP.
Sourcefn serves_self_resources(&self) -> bool
fn serves_self_resources(&self) -> bool
Whether this handler exposes any agentd:// self-resources — so the loop
offers the resource.read tool even when no MCP resources exist. Default
false.
Sourcefn take_scheduled(&mut self) -> Vec<ScheduleRequest>
fn take_scheduled(&mut self) -> Vec<ScheduleRequest>
Drain any future wake-ups the agent scheduled for itself this run.
Default: none. The loop attaches these to the run’s
Outcome so a daemon supervisor can
arm them.
Sourcefn take_subscriptions(&mut self) -> Vec<SubscriptionRequest>
fn take_subscriptions(&mut self) -> Vec<SubscriptionRequest>
Drain any resource (un)subscriptions the agent requested for itself this
run. Default: none. Attached to the run’s Outcome.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".