Skip to main content

McpEngineClient

Struct McpEngineClient 

Source
pub struct McpEngineClient { /* private fields */ }
Expand description

A connected MCP client: initialize done, ready for tools/call.

Implementations§

Source§

impl McpEngineClient

Source

pub fn connect(spec: &EngineSpec) -> Result<Self>

Connect over the transport spec selects and run the handshake.

Source

pub fn connect_with(spec: &EngineSpec, timeout: Duration) -> Result<Self>

Self::connect with a per-request timeout.

Source

pub fn connect_stdio( command: &str, args: &[String], timeout: Duration, ) -> Result<Self>

Spawn command args… (stderr inherited) and connect over its stdio.

Source

pub fn protocol_version(&self) -> &str

The protocol revision the server answered with.

Source

pub fn server_info(&self) -> &Value

The server’s serverInfo ({ name, version }).

Source

pub fn request(&mut self, method: &str, params: Value) -> Result<Value>

One JSON-RPC request; the result, or the server’s error as Error::Other.

Source

pub fn notify(&mut self, method: &str, params: Value) -> Result<()>

One JSON-RPC notification (no reply).

Source

pub fn list_tools(&mut self) -> Result<Vec<Value>>

tools/list: the catalog as the server describes it.

Source

pub fn call_tool(&mut self, name: &str, args: Value) -> Result<ToolResult>

tools/call: the tool’s JSON body and its error flag. A reply whose text content is not JSON is an error (the reference’s tool <name> returned non-JSON).

Source

pub fn call(&mut self, name: &str, args: Value) -> Result<Value>

Self::call_tool with an error result turned into an error.

Source

pub fn close(&mut self) -> Result<()>

End the session: stdio — stdin EOF, wait, kill after the grace period; HTTP — DELETE with the session id. Idempotent.

Trait Implementations§

Source§

impl Debug for McpEngineClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for McpEngineClient

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl EngineClient for McpEngineClient

Source§

fn read_doc(&mut self, path: &str) -> Result<Option<DocBytes>>

docs_read by path; a tool error (doc_missing, …) reads as absent, as the reference treats it. The hash is computed here: the wire carries the bytes, not the store’s file_hash.

Source§

fn observe_many(&mut self, files: &[FileBytes]) -> Result<Vec<ObserveOutcome>>

Observe whole-file bytes as observed commits (echo-suppressed engine-side), one batch, then sweep the pool.
Source§

fn observe_delete(&mut self, path: &str) -> Result<DeleteOutcome>

Mirror a source-side deletion (tombstone, then sweep).
Source§

fn changes_since( &mut self, cursor: i64, limit: Option<usize>, origin: Option<&str>, ) -> Result<ChangesPage>

The repo’s change feed after cursor (§6).
Source§

fn close(&mut self) -> Result<()>

Release the connection (the store’s lifetime is the caller’s).

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.