Module: ModelContextProtocol::RSpec::Matchers
- Defined in:
- lib/model_context_protocol/rspec/matchers.rb,
lib/model_context_protocol/rspec/matchers/have_text_content.rb,
lib/model_context_protocol/rspec/matchers/be_valid_mcp_class.rb,
lib/model_context_protocol/rspec/matchers/have_audio_content.rb,
lib/model_context_protocol/rspec/matchers/have_image_content.rb,
lib/model_context_protocol/rspec/matchers/have_message_count.rb,
lib/model_context_protocol/rspec/matchers/have_resource_blob.rb,
lib/model_context_protocol/rspec/matchers/have_resource_text.rb,
lib/model_context_protocol/rspec/matchers/be_mcp_error_response.rb,
lib/model_context_protocol/rspec/matchers/have_message_with_role.rb,
lib/model_context_protocol/rspec/matchers/have_resource_mime_type.rb,
lib/model_context_protocol/rspec/matchers/have_structured_content.rb,
lib/model_context_protocol/rspec/matchers/have_resource_annotations.rb,
lib/model_context_protocol/rspec/matchers/be_valid_mcp_tool_response.rb,
lib/model_context_protocol/rspec/matchers/have_resource_link_content.rb,
lib/model_context_protocol/rspec/matchers/be_valid_mcp_prompt_response.rb,
lib/model_context_protocol/rspec/matchers/be_valid_mcp_resource_response.rb,
lib/model_context_protocol/rspec/matchers/have_embedded_resource_content.rb
Defined Under Namespace
Classes: BeMcpErrorResponse, BeValidMcpClass, BeValidMcpPromptResponse, BeValidMcpResourceResponse, BeValidMcpToolResponse, HaveAudioContent, HaveEmbeddedResourceContent, HaveImageContent, HaveMessageCount, HaveMessageWithRole, HaveResourceAnnotations, HaveResourceBlob, HaveResourceLinkContent, HaveResourceMimeType, HaveResourceText, HaveStructuredContent, HaveTextContent
Instance Method Summary collapse
-
#be_mcp_error_response(expected_message = nil) ⇒ Object
Matcher that validates a tool response is an error response.
-
#be_valid_mcp_class(expected_type = nil) ⇒ Object
Matcher that validates a class is a properly defined MCP class.
-
#be_valid_mcp_prompt_response ⇒ Object
Matcher that validates a response is a properly structured MCP prompt response.
-
#be_valid_mcp_resource_response ⇒ Object
Matcher that validates a response is a properly structured MCP resource response.
-
#be_valid_mcp_tool_response ⇒ Object
Matcher that validates a response is a properly structured MCP tool response.
-
#have_audio_content(mime_type: nil) ⇒ Object
Matcher that validates a tool response contains audio content.
-
#have_embedded_resource_content(uri: nil, mime_type: nil) ⇒ Object
Matcher that validates a tool response contains embedded resource content.
-
#have_image_content(mime_type: nil) ⇒ Object
Matcher that validates a tool response contains image content.
-
#have_message_count(expected_count) ⇒ Object
Matcher that validates a prompt response contains a specific number of messages.
-
#have_message_with_role(role) ⇒ Object
Matcher that validates a prompt response contains a message with a specific role.
-
#have_resource_annotations(expected_annotations) ⇒ Object
Matcher that validates a resource response has specific annotations.
-
#have_resource_blob(expected_blob = nil) ⇒ Object
Matcher that validates a resource response contains binary blob content.
-
#have_resource_link_content(uri: nil, name: nil) ⇒ Object
Matcher that validates a tool response contains resource link content.
-
#have_resource_mime_type(expected_mime_type) ⇒ Object
Matcher that validates a resource response has a specific mime type.
-
#have_resource_text(expected_text) ⇒ Object
Matcher that validates a resource response contains specific text content.
-
#have_structured_content(expected_content) ⇒ Object
Matcher that validates a tool response contains specific structured content.
-
#have_text_content(expected_text) ⇒ Object
Matcher that validates a tool response contains specific text content.
Instance Method Details
#be_mcp_error_response(expected_message = nil) ⇒ Object
Matcher that validates a tool response is an error response.
17 18 19 |
# File 'lib/model_context_protocol/rspec/matchers/be_mcp_error_response.rb', line 17 def be_mcp_error_response( = nil) BeMcpErrorResponse.new() end |
#be_valid_mcp_class(expected_type = nil) ⇒ Object
Matcher that validates a class is a properly defined MCP class.
17 18 19 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_class.rb', line 17 def be_valid_mcp_class(expected_type = nil) BeValidMcpClass.new(expected_type) end |
#be_valid_mcp_prompt_response ⇒ Object
Matcher that validates a response is a properly structured MCP prompt response.
11 12 13 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_prompt_response.rb', line 11 def be_valid_mcp_prompt_response BeValidMcpPromptResponse.new end |
#be_valid_mcp_resource_response ⇒ Object
Matcher that validates a response is a properly structured MCP resource response.
11 12 13 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_resource_response.rb', line 11 def be_valid_mcp_resource_response BeValidMcpResourceResponse.new end |
#be_valid_mcp_tool_response ⇒ Object
Matcher that validates a response is a properly structured MCP tool response.
11 12 13 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_tool_response.rb', line 11 def be_valid_mcp_tool_response BeValidMcpToolResponse.new end |
#have_audio_content(mime_type: nil) ⇒ Object
Matcher that validates a tool response contains audio content.
14 15 16 |
# File 'lib/model_context_protocol/rspec/matchers/have_audio_content.rb', line 14 def have_audio_content(mime_type: nil) HaveAudioContent.new(mime_type: mime_type) end |
#have_embedded_resource_content(uri: nil, mime_type: nil) ⇒ Object
Matcher that validates a tool response contains embedded resource content.
14 15 16 |
# File 'lib/model_context_protocol/rspec/matchers/have_embedded_resource_content.rb', line 14 def (uri: nil, mime_type: nil) HaveEmbeddedResourceContent.new(uri: uri, mime_type: mime_type) end |
#have_image_content(mime_type: nil) ⇒ Object
Matcher that validates a tool response contains image content.
14 15 16 |
# File 'lib/model_context_protocol/rspec/matchers/have_image_content.rb', line 14 def have_image_content(mime_type: nil) HaveImageContent.new(mime_type: mime_type) end |
#have_message_count(expected_count) ⇒ Object
Matcher that validates a prompt response contains a specific number of messages.
11 12 13 |
# File 'lib/model_context_protocol/rspec/matchers/have_message_count.rb', line 11 def (expected_count) HaveMessageCount.new(expected_count) end |
#have_message_with_role(role) ⇒ Object
Matcher that validates a prompt response contains a message with a specific role.
17 18 19 |
# File 'lib/model_context_protocol/rspec/matchers/have_message_with_role.rb', line 17 def (role) HaveMessageWithRole.new(role) end |
#have_resource_annotations(expected_annotations) ⇒ Object
Matcher that validates a resource response has specific annotations.
17 18 19 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_annotations.rb', line 17 def have_resource_annotations(expected_annotations) HaveResourceAnnotations.new(expected_annotations) end |
#have_resource_blob(expected_blob = nil) ⇒ Object
Matcher that validates a resource response contains binary blob content.
14 15 16 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_blob.rb', line 14 def have_resource_blob(expected_blob = nil) HaveResourceBlob.new(expected_blob) end |
#have_resource_link_content(uri: nil, name: nil) ⇒ Object
Matcher that validates a tool response contains resource link content.
20 21 22 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_link_content.rb', line 20 def have_resource_link_content(uri: nil, name: nil) HaveResourceLinkContent.new(uri: uri, name: name) end |
#have_resource_mime_type(expected_mime_type) ⇒ Object
Matcher that validates a resource response has a specific mime type.
14 15 16 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_mime_type.rb', line 14 def have_resource_mime_type(expected_mime_type) HaveResourceMimeType.new(expected_mime_type) end |
#have_resource_text(expected_text) ⇒ Object
Matcher that validates a resource response contains specific text content.
14 15 16 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_text.rb', line 14 def have_resource_text(expected_text) HaveResourceText.new(expected_text) end |
#have_structured_content(expected_content) ⇒ Object
Matcher that validates a tool response contains specific structured content.
14 15 16 |
# File 'lib/model_context_protocol/rspec/matchers/have_structured_content.rb', line 14 def have_structured_content(expected_content) HaveStructuredContent.new(expected_content) end |
#have_text_content(expected_text) ⇒ Object
Matcher that validates a tool response contains specific text content.
14 15 16 |
# File 'lib/model_context_protocol/rspec/matchers/have_text_content.rb', line 14 def have_text_content(expected_text) HaveTextContent.new(expected_text) end |