pub struct McpTestUtils;Expand description
Test utilities for common MCP operations
Implementations§
Source§impl McpTestUtils
impl McpTestUtils
Sourcepub fn create_tool_request(
name: &str,
arguments: Option<Value>,
) -> CallToolRequest
pub fn create_tool_request( name: &str, arguments: Option<Value>, ) -> CallToolRequest
Create a test tool request
Sourcepub fn create_resource_request(uri: &str) -> ReadResourceRequest
pub fn create_resource_request(uri: &str) -> ReadResourceRequest
Create a test resource request
Sourcepub fn create_prompt_request(
name: &str,
arguments: Option<Value>,
) -> GetPromptRequest
pub fn create_prompt_request( name: &str, arguments: Option<Value>, ) -> GetPromptRequest
Create a test prompt request
Sourcepub fn assert_tool_result_contains(
result: &CallToolResult,
expected_content: &str,
)
pub fn assert_tool_result_contains( result: &CallToolResult, expected_content: &str, )
Assert that a tool result contains expected content
§Panics
Panics if the tool result is an error or doesn’t contain the expected content
Sourcepub fn assert_resource_result_contains(
result: &ReadResourceResult,
expected_content: &str,
)
pub fn assert_resource_result_contains( result: &ReadResourceResult, expected_content: &str, )
Assert that a resource result contains expected content
§Panics
Panics if the resource result is empty or doesn’t contain the expected content
Sourcepub fn assert_prompt_result_contains(
result: &GetPromptResult,
expected_content: &str,
)
pub fn assert_prompt_result_contains( result: &GetPromptResult, expected_content: &str, )
Assert that a prompt result contains expected content
§Panics
Panics if the prompt result is an error or doesn’t contain the expected content
Sourcepub fn assert_tool_result_is_json(result: &CallToolResult) -> Value
pub fn assert_tool_result_is_json(result: &CallToolResult) -> Value
Assert that a tool result is valid JSON
§Panics
Panics if the tool result is an error or contains invalid JSON
Sourcepub fn assert_resource_result_is_json(result: &ReadResourceResult) -> Value
pub fn assert_resource_result_is_json(result: &ReadResourceResult) -> Value
Assert that a resource result is valid JSON
§Panics
Panics if the resource result is empty or contains invalid JSON
Sourcepub fn create_test_data() -> MockDatabase
pub fn create_test_data() -> MockDatabase
Create test data for various scenarios
Sourcepub fn create_test_data_with_scenarios() -> MockDatabase
pub fn create_test_data_with_scenarios() -> MockDatabase
Create test data with specific scenarios
Auto Trait Implementations§
impl Freeze for McpTestUtils
impl RefUnwindSafe for McpTestUtils
impl Send for McpTestUtils
impl Sync for McpTestUtils
impl Unpin for McpTestUtils
impl UnwindSafe for McpTestUtils
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> 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 more