pub struct McpServer { /* private fields */ }Expand description
MCP server wrapping a MemoryService.
Implementations§
Source§impl McpServer
impl McpServer
Sourcepub fn compile_context_tool_attr() -> Tool
pub fn compile_context_tool_attr() -> Tool
Generated tool metadata function for compile_context
Sourcepub fn compile_transcript_tool_attr() -> Tool
pub fn compile_transcript_tool_attr() -> Tool
Generated tool metadata function for compile_transcript
Sourcepub fn context_savings_tool_attr() -> Tool
pub fn context_savings_tool_attr() -> Tool
Generated tool metadata function for context_savings
Sourcepub fn explain_compilation_tool_attr() -> Tool
pub fn explain_compilation_tool_attr() -> Tool
Generated tool metadata function for explain_compilation
Sourcepub fn retrieve_context_source_tool_attr() -> Tool
pub fn retrieve_context_source_tool_attr() -> Tool
Generated tool metadata function for retrieve_context_source
Sourcepub fn save_working_context_tool_attr() -> Tool
pub fn save_working_context_tool_attr() -> Tool
Generated tool metadata function for save_working_context
Sourcepub fn load_working_context_tool_attr() -> Tool
pub fn load_working_context_tool_attr() -> Tool
Generated tool metadata function for load_working_context
Sourcepub fn list_working_contexts_tool_attr() -> Tool
pub fn list_working_contexts_tool_attr() -> Tool
Generated tool metadata function for list_working_contexts
Sourcepub fn suggest_budget_tool_attr() -> Tool
pub fn suggest_budget_tool_attr() -> Tool
Generated tool metadata function for suggest_budget
Source§impl McpServer
impl McpServer
Sourcepub fn recall_fused_tool_attr() -> Tool
pub fn recall_fused_tool_attr() -> Tool
Generated tool metadata function for recall_fused
Sourcepub fn why_tool_attr() -> Tool
pub fn why_tool_attr() -> Tool
Generated tool metadata function for why
Sourcepub fn remember_extracted_tool_attr() -> Tool
pub fn remember_extracted_tool_attr() -> Tool
Generated tool metadata function for remember_extracted
Sourcepub fn extraction_status_tool_attr() -> Tool
pub fn extraction_status_tool_attr() -> Tool
Generated tool metadata function for extraction_status
Sourcepub fn list_memories_tool_attr() -> Tool
pub fn list_memories_tool_attr() -> Tool
Generated tool metadata function for list_memories
Source§impl McpServer
impl McpServer
Sourcepub fn migration_start_tool_attr() -> Tool
pub fn migration_start_tool_attr() -> Tool
Generated tool metadata function for migration_start
Sourcepub fn migration_status_tool_attr() -> Tool
pub fn migration_status_tool_attr() -> Tool
Generated tool metadata function for migration_status
Sourcepub fn migration_cancel_tool_attr() -> Tool
pub fn migration_cancel_tool_attr() -> Tool
Generated tool metadata function for migration_cancel
Sourcepub fn migration_recover_tool_attr() -> Tool
pub fn migration_recover_tool_attr() -> Tool
Generated tool metadata function for migration_recover
Source§impl McpServer
impl McpServer
Sourcepub fn memory_status_tool_attr() -> Tool
pub fn memory_status_tool_attr() -> Tool
Generated tool metadata function for memory_status
Source§impl McpServer
impl McpServer
Sourcepub fn new(service: MemoryService<DynEmbedder>) -> Self
pub fn new(service: MemoryService<DynEmbedder>) -> Self
Wrap a memory service as an MCP server.
Sourcepub fn with_embedder_identity(
self,
model: impl Into<String>,
_dimension: usize,
) -> Self
pub fn with_embedder_identity( self, model: impl Into<String>, _dimension: usize, ) -> Self
Declare the running embedder’s identity (model name + vector width)
so memory_status can name it — and say whether recall is semantic.
Undeclared, the status reports the embedder as unreported rather than
guessing from the service, which only ever sees &[f32].
Sourcepub fn with_store_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn with_store_dir(self, dir: impl Into<PathBuf>) -> Self
Point memory_status at the store directory so it can relay the
embedding-provenance record (#1751). Without it the provenance block
reports recorded: false.
Sourcepub fn with_online_migration<F>(
self,
source: impl Into<PathBuf>,
factory: F,
) -> Result<Self, MemoryError>
pub fn with_online_migration<F>( self, source: impl Into<PathBuf>, factory: F, ) -> Result<Self, MemoryError>
Attach the daemon-owned online migration control plane.
§Errors
Returns an error when its durable control directory cannot be created safely.
Sourcepub fn with_extractor(self, extractor: DynExtractor) -> Self
pub fn with_extractor(self, extractor: DynExtractor) -> Self
Attach an extraction backend, enabling the remember_extracted tool.
Without it the tool reports that extraction is not configured.
Sourcepub fn with_named_extractor(
self,
backend: impl Into<String>,
extractor: DynExtractor,
) -> Result<Self, String>
pub fn with_named_extractor( self, backend: impl Into<String>, extractor: DynExtractor, ) -> Result<Self, String>
Attach the named daemon-level default used when remember_extracted
omits its per-call extractor choice.
§Errors
Returns an error when backend is unknown or disables extraction.
Sourcepub fn with_extraction_jobs(
self,
store_root: impl AsRef<Path>,
) -> Result<Self, String>
pub fn with_extraction_jobs( self, store_root: impl AsRef<Path>, ) -> Result<Self, String>
Enable the durable extraction-job worker under the native store root.
Call this after opening the store and before serving requests. Accepted and in-flight records are recovered immediately; corrupt durable state fails startup instead of silently losing a receipt.
§Errors
Returns a descriptive error if the job directory cannot be created, validated, read, or if the recovery worker cannot start.
Sourcepub fn with_default_ttl(self, ttl_seconds: u64) -> Self
pub fn with_default_ttl(self, ttl_seconds: u64) -> Self
Apply a default TTL (seconds) to rememberd facts that don’t carry their
own ttl_seconds. 0 is treated as “no default” (permanent).
Sourcepub fn with_ingest_roots(self, roots: IngestRoots) -> Self
pub fn with_ingest_roots(self, roots: IngestRoots) -> Self
Enable path ingestion (V2b-1): compile_context and
explain_compilation fragments carrying path are resolved against
this allowlist before compilation. Without this (the default), every
path fragment fails with an explicit “ingestion disabled” error —
same pattern as Self::with_extractor.
Sourcepub fn remember_tool_attr() -> Tool
pub fn remember_tool_attr() -> Tool
Generated tool metadata function for remember
Sourcepub fn recall_tool_attr() -> Tool
pub fn recall_tool_attr() -> Tool
Generated tool metadata function for recall
Sourcepub fn recall_where_tool_attr() -> Tool
pub fn recall_where_tool_attr() -> Tool
Generated tool metadata function for recall_where
Sourcepub fn feedback_tool_attr() -> Tool
pub fn feedback_tool_attr() -> Tool
Generated tool metadata function for feedback
Sourcepub fn relate_tool_attr() -> Tool
pub fn relate_tool_attr() -> Tool
Generated tool metadata function for relate
Sourcepub fn unrelate_tool_attr() -> Tool
pub fn unrelate_tool_attr() -> Tool
Generated tool metadata function for unrelate
Sourcepub fn forget_tool_attr() -> Tool
pub fn forget_tool_attr() -> Tool
Generated tool metadata function for forget
Sourcepub fn entity_tool_attr() -> Tool
pub fn entity_tool_attr() -> Tool
Generated tool metadata function for entity
Trait Implementations§
Source§impl ServerHandler for McpServer
impl ServerHandler for McpServer
Source§async fn call_tool(
&self,
request: CallToolRequestParams,
context: RequestContext<RoleServer>,
) -> Result<CallToolResponse, ErrorData>
async fn call_tool( &self, request: CallToolRequestParams, context: RequestContext<RoleServer>, ) -> Result<CallToolResponse, ErrorData>
One trace event per tool call (#1780): tool name, session id, verdict,
duration — never an argument or fact content
(tests/daemon_logging.rs holds a canary against that). Written by
hand so the event wraps the dispatch — #[tool_handler] sees the
method already exists and only generates list_tools; the dispatch
below is exactly what the macro would have generated.
fn get_info(&self) -> ServerInfo
async fn list_tools( &self, _request: Option<PaginatedRequestParams>, context: RequestContext<RoleServer>, ) -> Result<ListToolsResult, ErrorData>
fn ping( &self, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
fn initialize( &self, request: InitializeRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<InitializeResult, ErrorData>> + MaybeSendFuture
Source§fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
Source§fn discover(
&self,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<DiscoverResult, ErrorData>> + MaybeSendFuture
fn discover( &self, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<DiscoverResult, ErrorData>> + MaybeSendFuture
fn complete( &self, request: CompleteRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CompleteResult, ErrorData>> + MaybeSendFuture
fn set_level( &self, request: SetLevelRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
fn get_prompt( &self, request: GetPromptRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<GetPromptResponse, ErrorData>> + MaybeSendFuture
fn list_prompts( &self, request: Option<PaginatedRequestParams>, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListPromptsResult, ErrorData>> + MaybeSendFuture
fn list_resources( &self, request: Option<PaginatedRequestParams>, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListResourcesResult, ErrorData>> + MaybeSendFuture
fn list_resource_templates( &self, request: Option<PaginatedRequestParams>, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListResourceTemplatesResult, ErrorData>> + MaybeSendFuture
fn read_resource( &self, request: ReadResourceRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ReadResourceResponse, ErrorData>> + MaybeSendFuture
Source§fn accepted_subscription_filter(
&self,
requested: &SubscriptionFilter,
) -> Option<SubscriptionFilter>
fn accepted_subscription_filter( &self, requested: &SubscriptionFilter, ) -> Option<SubscriptionFilter>
Source§fn listen(
&self,
context: SubscriptionContext,
) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
fn listen( &self, context: SubscriptionContext, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
Source§fn subscribe(
&self,
request: SubscribeRequestParams,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
fn subscribe( &self, request: SubscribeRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
resources/subscribe is legacy-only; implement accepted_subscription_filter and listen for protocol version 2026-07-28
Source§fn unsubscribe(
&self,
request: UnsubscribeRequestParams,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
fn unsubscribe( &self, request: UnsubscribeRequestParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
resources/unsubscribe is legacy-only; subscriptions/listen is cancelled through its request lifecycle
fn on_custom_request( &self, request: CustomRequest, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CustomResult, ErrorData>> + MaybeSendFuture
fn on_cancelled( &self, notification: CancelledNotificationParam, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_progress( &self, notification: ProgressNotificationParam, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_initialized( &self, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_roots_list_changed( &self, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_custom_notification( &self, notification: CustomNotification, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + MaybeSendFuture
Source§fn get_task(
&self,
request: GetTaskParams,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<GetTaskResult, ErrorData>> + MaybeSendFuture
fn get_task( &self, request: GetTaskParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<GetTaskResult, ErrorData>> + MaybeSendFuture
tasks/get: return the current DetailedTask state.Source§fn update_task(
&self,
request: UpdateTaskParams,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
fn update_task( &self, request: UpdateTaskParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
tasks/update: accept responses to outstanding in-task
input requests. Returns an empty acknowledgement on success.Source§fn cancel_task(
&self,
request: CancelTaskParams,
context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
fn cancel_task( &self, request: CancelTaskParams, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
tasks/cancel: cooperative cancellation. Returns an empty
acknowledgement; the task’s observable status may lag.Auto Trait Implementations§
impl !RefUnwindSafe for McpServer
impl !UnwindSafe for McpServer
impl Freeze for McpServer
impl Send for McpServer
impl Sync for McpServer
impl Unpin for McpServer
impl UnsafeUnpin for McpServer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<R, S> DynService<R> for Swhere
R: ServiceRole,
S: Service<R>,
impl<R, S> DynService<R> for Swhere
R: ServiceRole,
S: Service<R>,
fn handle_request( &self, request: <R as ServiceRole>::PeerReq, context: RequestContext<R>, ) -> Pin<Box<dyn Future<Output = Result<<R as ServiceRole>::Resp, ErrorData>> + Send + '_>>
fn handle_notification( &self, notification: <R as ServiceRole>::PeerNot, context: NotificationContext<R>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorData>> + Send + '_>>
fn get_info(&self) -> <R as ServiceRole>::Info
Source§fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<H> Service<RoleServer> for Hwhere
H: ServerHandler,
impl<H> Service<RoleServer> for Hwhere
H: ServerHandler,
async fn handle_request( &self, request: <RoleServer as ServiceRole>::PeerReq, context: RequestContext<RoleServer>, ) -> Result<<RoleServer as ServiceRole>::Resp, ErrorData>
async fn handle_notification( &self, notification: <RoleServer as ServiceRole>::PeerNot, context: NotificationContext<RoleServer>, ) -> Result<(), ErrorData>
fn get_info(&self) -> <RoleServer as ServiceRole>::Info
Source§fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
fn supported_protocol_versions(&self) -> Cow<'static, [ProtocolVersion]>
initialize
negotiation may agree to. Read more