pub struct McpAdapter { /* private fields */ }Expand description
MCP to DCP adapter
Implementations§
Source§impl McpAdapter
impl McpAdapter
Sourcepub fn new() -> McpAdapter
pub fn new() -> McpAdapter
Create a new adapter
Sourcepub fn with_max_request_size(self, max_request_size: usize) -> McpAdapter
pub fn with_max_request_size(self, max_request_size: usize) -> McpAdapter
Set maximum JSON-RPC request size for adapter entry points.
Sourcepub fn with_negotiated_capabilities(
self,
capabilities: CapabilityManifest,
) -> McpAdapter
pub fn with_negotiated_capabilities( self, capabilities: CapabilityManifest, ) -> McpAdapter
Set the negotiated capability manifest for legacy adapter execution.
Sourcepub fn register_tool(
&mut self,
name: impl Into<String>,
tool_id: u16,
) -> Result<u16, AdapterError>
pub fn register_tool( &mut self, name: impl Into<String>, tool_id: u16, ) -> Result<u16, AdapterError>
Register a tool mapping
Sourcepub fn resolve_tool_name(&self, name: &str) -> Option<u16>
pub fn resolve_tool_name(&self, name: &str) -> Option<u16>
Resolve MCP tool name to DCP tool_id
Sourcepub fn resolve_tool_id(&self, tool_id: u16) -> Option<&str>
pub fn resolve_tool_id(&self, tool_id: u16) -> Option<&str>
Resolve DCP tool_id to MCP tool name
Sourcepub fn security_audit(&self) -> SecurityAuditLog
pub fn security_audit(&self) -> SecurityAuditLog
Get structured security audit receipts.
Sourcepub fn parse_request(&self, json: &str) -> Result<JsonRpcRequest, AdapterError>
pub fn parse_request(&self, json: &str) -> Result<JsonRpcRequest, AdapterError>
Parse an MCP JSON-RPC request
Sourcepub fn translate_params(&self, params: &Option<Value>) -> Vec<u8> ⓘ
pub fn translate_params(&self, params: &Option<Value>) -> Vec<u8> ⓘ
Translate MCP request params to DCP arguments
Sourcepub fn translate_result(&self, result: &ToolResult) -> Value
pub fn translate_result(&self, result: &ToolResult) -> Value
Translate DCP result to MCP response value
Sourcepub fn format_success_response(
&self,
id: RequestId,
result: Value,
) -> Result<String, AdapterError>
pub fn format_success_response( &self, id: RequestId, result: Value, ) -> Result<String, AdapterError>
Format a success response
Sourcepub fn format_error_response(
&self,
id: RequestId,
error: JsonRpcError,
) -> Result<String, AdapterError>
pub fn format_error_response( &self, id: RequestId, error: JsonRpcError, ) -> Result<String, AdapterError>
Format an error response
Sourcepub fn handle_initialize(
&self,
request: &JsonRpcRequest,
) -> Result<String, AdapterError>
pub fn handle_initialize( &self, request: &JsonRpcRequest, ) -> Result<String, AdapterError>
Handle an MCP initialize request
Sourcepub fn handle_tools_list(
&self,
request: &JsonRpcRequest,
) -> Result<String, AdapterError>
pub fn handle_tools_list( &self, request: &JsonRpcRequest, ) -> Result<String, AdapterError>
Handle an MCP tools/list request
Sourcepub fn handle_tools_call(
&self,
request: &JsonRpcRequest,
router: &BinaryTrieRouter,
) -> Result<String, AdapterError>
pub fn handle_tools_call( &self, request: &JsonRpcRequest, router: &BinaryTrieRouter, ) -> Result<String, AdapterError>
Handle an MCP tools/call request
Sourcepub fn handle_request(
&self,
json: &str,
router: &BinaryTrieRouter,
) -> Result<String, AdapterError>
pub fn handle_request( &self, json: &str, router: &BinaryTrieRouter, ) -> Result<String, AdapterError>
Handle a generic MCP request
Sourcepub fn tool_count(&self) -> usize
pub fn tool_count(&self) -> usize
Get the number of registered tools
Trait Implementations§
Source§impl Default for McpAdapter
impl Default for McpAdapter
Source§fn default() -> McpAdapter
fn default() -> McpAdapter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for McpAdapter
impl RefUnwindSafe for McpAdapter
impl Send for McpAdapter
impl Sync for McpAdapter
impl Unpin for McpAdapter
impl UnsafeUnpin for McpAdapter
impl UnwindSafe for McpAdapter
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.