pub struct ChatToolSession { /* private fields */ }Expand description
A chat-scoped MCP lifecycle: discovery happened, specs are ready, and every call goes through the shared runtime.
Implementations§
Source§impl ChatToolSession
impl ChatToolSession
Sourcepub async fn from_config(
config: &Config,
provider: Arc<GenAIProvider>,
model: &str,
) -> Result<Option<(Self, Vec<String>)>>
pub async fn from_config( config: &Config, provider: Arc<GenAIProvider>, model: &str, ) -> Result<Option<(Self, Vec<String>)>>
Build and discover the chat-mode session; None when no server is
configured for chat. Failing servers are skipped with a notice.
pub fn has_tools(&self) -> bool
Sourcepub fn tool_names(&self) -> Vec<String>
pub fn tool_names(&self) -> Vec<String>
Namespaced names of the tools admitted for this chat lifecycle.
The TUI uses this for local discovery only (/mcp); descriptions and
schemas remain in the provider request and are never treated as local
instructions.
pub fn try_next_elicitation(&self) -> Option<McpPendingElicitation>
pub fn respond_elicitation( &self, id: u64, action: McpElicitationAction, content: Option<Value>, ) -> Result<()>
Sourcepub async fn run_turn(
&self,
provider: &GenAIProvider,
model: &str,
messages: Vec<CoreMessage>,
updates: &UnboundedSender<String>,
) -> Result<()>
pub async fn run_turn( &self, provider: &GenAIProvider, model: &str, messages: Vec<CoreMessage>, updates: &UnboundedSender<String>, ) -> Result<()>
Run one chat message with bounded, model-selected tool rounds.
Genuine model reasoning and final answer text are streamed through
updates. MCP activity uses a separate transient marker; protocol
notifications stay in logs and never enter the conversation.
Trait Implementations§
Source§impl Clone for ChatToolSession
impl Clone for ChatToolSession
Source§fn clone(&self) -> ChatToolSession
fn clone(&self) -> ChatToolSession
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ChatToolSession
impl !RefUnwindSafe for ChatToolSession
impl Send for ChatToolSession
impl Sync for ChatToolSession
impl Unpin for ChatToolSession
impl UnsafeUnpin for ChatToolSession
impl !UnwindSafe for ChatToolSession
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.