Skip to main content

McpServer

Struct McpServer 

Source
pub struct McpServer {
    session: Session,
    heard: Option<(Arc<Mutex<HashSet<String>>>, Out)>,
    came: Instant,
}
Expand description

One editor, driven by tools.

Fields§

§session: Session§heard: Option<(Arc<Mutex<HashSet<String>>>, Out)>

What is cancelled, and where to say how far a call is, as serve has them.

§came: Instant

When the message being answered came: how long it waited.

Implementations§

Source§

impl McpServer

Source

pub fn new() -> Self

Source

pub fn handle(&mut self, line: &str) -> Option<Value>

Answers one JSON-RPC message, or nothing for a notification.

Source

fn call( &mut self, name: &str, arguments: &Value, id: &Value, token: Option<Value>, ) -> Value

Calls the tool name with arguments, as tools/call answers: its result as text, or why it failed as an error result. A kernel that panics leaves the editor in an unknown state: a fresh one takes over, with the program as it was before the call.

Source

fn watcher( &self, id: &Value, token: Option<Value>, deadline: Option<Instant>, ) -> impl FnMut(&Progress<'_>) -> bool + 'static

What watches the call id: it tells the client how far it is, if the client gave a token to say it by, no more than once a second, and stops it once it is cancelled, or at deadline.

Source

fn guarded<T>( &mut self, what: &str, f: impl FnOnce(&mut Session) -> GeopResult<T>, ) -> Result<T, String>

f on the session, or why it failed. A kernel that panics leaves the editor in an unknown state: a fresh one takes over, with the program as it was before, and the panic is told as what what did.

Trait Implementations§

Source§

impl Default for McpServer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.