pub struct Server { /* private fields */ }Expand description
One MCP server, shared by the tools it offers.
Implementations§
Source§impl Server
impl Server
Sourcepub fn start(
spec: &Spec,
plugin_dir: &Path,
workspace: &Path,
default_timeout: Duration,
secrets: &Secrets,
) -> Result<(Arc<Self>, Vec<RemoteTool>), String>
pub fn start( spec: &Spec, plugin_dir: &Path, workspace: &Path, default_timeout: Duration, secrets: &Secrets, ) -> Result<(Arc<Self>, Vec<RemoteTool>), String>
Start a server and ask it what it can do. Blocking on purpose: this runs while a registry is being built, outside any turn, and a manifest that names a broken server should say so at startup rather than at the first tool call.
pub fn name(&self) -> &str
pub fn prefix(&self) -> &str
pub fn override_builtin(&self) -> bool
Sourcepub fn policy_for(&self, remote: &str) -> Policy
pub fn policy_for(&self, remote: &str) -> Policy
The policy a remote tool gets: its own override, else the server’s.
Sourcepub fn call_tool(&self, remote: &str, args: &Value) -> Result<String, String>
pub fn call_tool(&self, remote: &str, args: &Value) -> Result<String, String>
tools/call, from a thread that is allowed to block.
Sourcepub fn call_tool_unless(
&self,
remote: &str,
args: &Value,
cancel: &Cancel,
) -> Result<String, String>
pub fn call_tool_unless( &self, remote: &str, args: &Value, cancel: &Cancel, ) -> Result<String, String>
call_tool with a run’s cancellation flag.
A tool call is not interruptible — it is a blocking read on a pipe — but waiting for it is. When the run is cancelled the answer has nowhere to go, so the wait stops, the connection is dropped (which kills the server) and the caller gets the reason.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Server
impl Forget for Server
impl Move for Server
impl RefUnwindSafe for Serverwhere
Atomic<i64>: RefUnwindSafe,
Mutex<Option<Conn>>: RefUnwindSafe,
Mutex<Option<Value>>: RefUnwindSafe,
Atomic<usize>: RefUnwindSafe,
Mutex<String>: RefUnwindSafe,
impl Send for Server
impl Sync for Server
impl Unpin for Serverwhere
*const u8 is !null: Unpin,
*const LeafNode<String, Policy> is !null: Unpin,
Box<(String, Policy)>: Unpin,
*const LeafNode<String, String> is !null: Unpin,
Box<(String, String)>: Unpin,
Align8<i64>: Unpin,
Align4<u32>: Unpin,
Align1<u8>: Unpin,
I32NotAllOnes: Unpin,
*mut Counter<Channel<Value>>: Unpin,
*mut Counter<Channel<Value>>: Unpin,
*mut Counter<Channel<Value>>: Unpin,
Arc<ClientRef>: Unpin,
Arc<Atomic<bool>>: Unpin,
*const LeafNode<String, Value> is !null: Unpin,
Box<(String, Value)>: Unpin,
Arc<Mutex<String>>: Unpin,
impl UnsafeUnpin for Serverwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
*const LeafNode<String, Policy> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Policy)>>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
Align8<i64>: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
I32NotAllOnes: UnsafeUnpin,
*mut Counter<Channel<Value>>: UnsafeUnpin,
*mut Counter<Channel<Value>>: UnsafeUnpin,
*mut Counter<Channel<Value>>: UnsafeUnpin,
*const ArcInner<ClientRef> is !null: UnsafeUnpin,
PhantomData<ArcInner<ClientRef>>: UnsafeUnpin,
*const ArcInner<Atomic<bool>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Atomic<bool>>>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
*const ArcInner<Mutex<String>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<String>>>: UnsafeUnpin,
impl UnwindSafe for Serverwhere
RawVecInner: UnwindSafe,
BTreeMap<String, Policy>: UnwindSafe,
BTreeMap<String, String>: UnwindSafe,
Align8<i64>: UnwindSafe,
Mutex<Option<Conn>>: UnwindSafe,
Mutex<Option<Value>>: UnwindSafe,
Arc<Mutex<String>>: UnwindSafe,
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