ThingsMcpServer

Struct ThingsMcpServer 

Source
pub struct ThingsMcpServer {
    pub db: Arc<ThingsDatabase>,
    /* private fields */
}
Expand description

MCP server for Things 3 integration

Fields§

§db: Arc<ThingsDatabase>

Implementations§

Source§

impl ThingsMcpServer

Source

pub fn new(db: Arc<ThingsDatabase>, config: ThingsConfig) -> Self

Source

pub fn with_middleware_config( db: ThingsDatabase, config: ThingsConfig, middleware_config: MiddlewareConfig, ) -> Self

Create a new MCP server with custom middleware configuration

Source

pub fn new_with_mcp_config( db: Arc<ThingsDatabase>, config: ThingsConfig, mcp_config: McpServerConfig, ) -> Self

Create a new MCP server with comprehensive configuration

Source

pub fn middleware_chain(&self) -> &MiddlewareChain

Get the middleware chain for inspection or modification

Source

pub fn list_tools(&self) -> McpResult<ListToolsResult>

List available MCP tools

§Errors

Returns an error if tool generation fails

Source

pub async fn call_tool( &self, request: CallToolRequest, ) -> McpResult<CallToolResult>

Call a specific MCP tool

§Errors

Returns an error if tool execution fails or tool is not found

Source

pub async fn call_tool_with_fallback( &self, request: CallToolRequest, ) -> CallToolResult

Call a specific MCP tool with fallback error handling

This method provides backward compatibility by converting McpError to CallToolResult for cases where the caller expects a CallToolResult even on error

Source

pub fn list_resources(&self) -> McpResult<ListResourcesResult>

List available MCP resources

§Errors

Returns an error if resource generation fails

Source

pub async fn read_resource( &self, request: ReadResourceRequest, ) -> McpResult<ReadResourceResult>

Read a specific MCP resource

§Errors

Returns an error if resource reading fails or resource is not found

Source

pub async fn read_resource_with_fallback( &self, request: ReadResourceRequest, ) -> ReadResourceResult

Read a specific MCP resource with fallback error handling

This method provides backward compatibility by converting McpError to ReadResourceResult for cases where the caller expects a ReadResourceResult even on error

Source

pub fn list_prompts(&self) -> McpResult<ListPromptsResult>

List available MCP prompts

§Errors

Returns an error if prompt generation fails

Source

pub async fn get_prompt( &self, request: GetPromptRequest, ) -> McpResult<GetPromptResult>

Get a specific MCP prompt with arguments

§Errors

Returns an error if prompt retrieval fails or prompt is not found

Source

pub async fn get_prompt_with_fallback( &self, request: GetPromptRequest, ) -> GetPromptResult

Get a specific MCP prompt with fallback error handling

This method provides backward compatibility by converting McpError to GetPromptResult for cases where the caller expects a GetPromptResult even on error

Source

pub async fn handle_jsonrpc_request( &self, request: Value, ) -> Result<Option<Value>>

Handle a JSON-RPC request and return a JSON-RPC response

Returns None for notifications (messages without id field) - these don’t require a response

§Errors

Returns an error if request parsing or handling fails

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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> 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.
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
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,