pub struct Tool {
pub name: String,
pub title: String,
pub description: String,
pub id: String,
pub input_schema: Value,
pub output_schema: Value,
pub effect: Effect,
pub hints: Hints,
}Expand description
One tool as a client lists it.
Fields§
§name: StringThe tool name a client calls.
title: StringThe title.
description: StringThe description.
id: StringThe canonical id the tool projects.
input_schema: ValueThe canonical input schema.
output_schema: ValueThe canonical output schema.
effect: EffectWhat the call changes: nothing, this process’s memory, or the repository.
hints: HintsWhat a caller may assume before calling, classified from the effect. The tool’s annotations are this value and nothing else.
Implementations§
Source§impl Tool
impl Tool
Sourcepub fn of(c: &Capability) -> Option<Tool>
pub fn of(c: &Capability) -> Option<Tool>
The tool a capability projects, when it projects one.
The one place a capability becomes a tool: its name is the declared exposure, and everything else — the schemas, the effect, what a caller may assume — is read from the capability, so a tool cannot say anything its capability does not.
use majordomus_cli::capability::{builtin, CapabilityRegistry, Effect};
use majordomus_cli::mcp::surface::Tool;
let registry = CapabilityRegistry::builder().with_builtin(builtin::all()).build().unwrap();
let c = registry.by_mcp_tool("majordomus_plan_transition").unwrap();
let tool = Tool::of(c).unwrap();
assert_eq!(tool.id, "plan.transition");
assert_eq!(tool.effect, Effect::RepositoryMutation);
assert!(tool.hints.destructive, "a tool that writes the repository is announced as one");Trait Implementations§
impl Eq for Tool
impl StructuralPartialEq for Tool
Auto Trait Implementations§
impl Freeze for Tool
impl RefUnwindSafe for Tool
impl Send for Tool
impl Sync for Tool
impl Unpin for Tool
impl UnsafeUnpin for Tool
impl UnwindSafe for Tool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.