ServerCapabilitiesBuilder

Struct ServerCapabilitiesBuilder 

Source
pub struct ServerCapabilitiesBuilder<S = ServerCapabilitiesBuilderState> { /* private fields */ }
Expand description

Const-generic ServerCapabilities builder with compile-time validation

This builder ensures that capability-specific methods are only available when the corresponding capability is enabled, providing compile-time safety with compile-time validation.

Implementations§

Source§

impl ServerCapabilitiesBuilder

Source

pub fn new() -> Self

Create a new ServerCapabilities builder

Source§

impl<S> ServerCapabilitiesBuilder<S>

Source

pub fn build(self) -> ServerCapabilities

Build the final ServerCapabilities

Consumes the builder and returns the configured ServerCapabilities. All compile-time validations have been enforced during building.

Source

pub fn with_strict_validation(self) -> Self

TurboMCP Extension: Enable strict validation mode

When enabled, the builder will perform additional runtime validations on top of the compile-time guarantees.

Source

pub fn with_negotiator(self, negotiator: CapabilityNegotiator) -> Self

TurboMCP Extension: Set capability negotiator

Integrates with TurboMCP’s sophisticated capability negotiation system for advanced client-server capability matching.

Source

pub fn validate(&self) -> Result<(), String>

TurboMCP Extension: Validate capability configuration

Performs additional runtime validation to ensure the capability configuration makes sense in the current context.

Source

pub fn summary(&self) -> String

Get a summary of enabled capabilities

Returns a human-readable summary of which capabilities are enabled.

Source§

impl<const L: bool, const C: bool, const P: bool, const R: bool, const T: bool> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<false, L, C, P, R, T>>

Source

pub fn enable_experimental( self, ) -> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<true, L, C, P, R, T>>

Enable experimental capabilities

Transitions the builder to a state where experimental capability methods become available at compile time.

Source

pub fn enable_experimental_with( self, experimental: HashMap<String, Value>, ) -> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<true, L, C, P, R, T>>

Enable experimental capabilities with specific values

Source§

impl<const E: bool, const C: bool, const P: bool, const R: bool, const T: bool> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, false, C, P, R, T>>

Source

pub fn enable_logging( self, ) -> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, true, C, P, R, T>>

Enable logging capabilities

Source§

impl<const E: bool, const L: bool, const P: bool, const R: bool, const T: bool> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, false, P, R, T>>

Source

pub fn enable_completions( self, ) -> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, true, P, R, T>>

Enable completion capabilities

Source§

impl<const E: bool, const L: bool, const C: bool, const R: bool, const T: bool> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, false, R, T>>

Source

pub fn enable_prompts( self, ) -> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, true, R, T>>

Enable prompts capabilities

Source§

impl<const E: bool, const L: bool, const C: bool, const P: bool, const T: bool> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, P, false, T>>

Source

pub fn enable_resources( self, ) -> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, P, true, T>>

Enable resources capabilities

Source§

impl<const E: bool, const L: bool, const C: bool, const P: bool, const R: bool> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, P, R, false>>

Source

pub fn enable_tools( self, ) -> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, P, R, true>>

Enable tools capabilities

Source§

impl<const E: bool, const L: bool, const C: bool, const P: bool, const R: bool> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, P, R, true>>

Source

pub fn enable_tool_list_changed(self) -> Self

Enable tool list changed notifications

This method is only available when tools capabilities are enabled, providing advanced compile-time validation.

Source§

impl<const E: bool, const L: bool, const C: bool, const R: bool, const T: bool> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, true, R, T>>

Source

pub fn enable_prompts_list_changed(self) -> Self

Enable prompts list changed notifications

Source§

impl<const E: bool, const L: bool, const C: bool, const P: bool, const T: bool> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, P, true, T>>

Source

pub fn enable_resources_list_changed(self) -> Self

Enable resources list changed notifications

Source

pub fn enable_resources_subscribe(self) -> Self

Enable resources subscribe capability

Source§

impl<const L: bool, const C: bool, const P: bool, const R: bool, const T: bool> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<true, L, C, P, R, T>>

Source

pub fn add_experimental_capability<K, V>(self, key: K, value: V) -> Self
where K: Into<String>, V: Into<Value>,

Add experimental capability

This method is only available when experimental capabilities are enabled.

Source

pub fn with_simd_optimization(self, level: &str) -> Self

TurboMCP Extension: Add SIMD optimization hint

Unique to TurboMCP - hints about SIMD capabilities for performance optimization.

Source

pub fn with_enterprise_security(self, enabled: bool) -> Self

TurboMCP Extension: Add enterprise security metadata

Unique to TurboMCP - metadata about security capabilities.

Source§

impl ServerCapabilitiesBuilder

Convenience methods for common capability combinations

TurboMCP Extension: Create a full-featured server configuration

Enables all standard capabilities with TurboMCP optimizations.

Source

pub fn minimal() -> ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<false, false, false, false, false, true>>

Create a minimal server configuration

Only enables tools capability for basic MCP compliance.

Trait Implementations§

Source§

impl<S: Clone> Clone for ServerCapabilitiesBuilder<S>

Source§

fn clone(&self) -> ServerCapabilitiesBuilder<S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug> Debug for ServerCapabilitiesBuilder<S>

Source§

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

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

impl Default for ServerCapabilitiesBuilder

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more