Module: ModelContextProtocol::RSpec::Helpers
- Defined in:
- lib/model_context_protocol/rspec/helpers.rb
Instance Method Summary collapse
-
#call_mcp_prompt(prompt_class, arguments = {}, context = {}) ⇒ Object
Calls an MCP prompt class with the given arguments and context.
-
#call_mcp_resource(resource_class, context = {}) ⇒ Object
Calls an MCP resource class with the given context.
-
#call_mcp_tool(tool_class, arguments = {}, context = {}) ⇒ Object
Calls an MCP tool class with the given arguments and context.
-
#null_logger ⇒ Logger
Creates a null logger for testing purposes.
Instance Method Details
#call_mcp_prompt(prompt_class, arguments = {}, context = {}) ⇒ Object
Calls an MCP prompt class with the given arguments and context.
36 37 38 |
# File 'lib/model_context_protocol/rspec/helpers.rb', line 36 def call_mcp_prompt(prompt_class, arguments = {}, context = {}) prompt_class.call(arguments, null_logger, null_logger, context) end |
#call_mcp_resource(resource_class, context = {}) ⇒ Object
Calls an MCP resource class with the given context.
49 50 51 |
# File 'lib/model_context_protocol/rspec/helpers.rb', line 49 def call_mcp_resource(resource_class, context = {}) resource_class.call(null_logger, null_logger, context) end |
#call_mcp_tool(tool_class, arguments = {}, context = {}) ⇒ Object
Calls an MCP tool class with the given arguments and context.
22 23 24 |
# File 'lib/model_context_protocol/rspec/helpers.rb', line 22 def call_mcp_tool(tool_class, arguments = {}, context = {}) tool_class.call(arguments, null_logger, null_logger, context) end |
#null_logger ⇒ Logger
Creates a null logger for testing purposes. Memoized per example so all helper calls in a single test share the same logger.
8 9 10 |
# File 'lib/model_context_protocol/rspec/helpers.rb', line 8 def null_logger @null_logger ||= Logger.new(File::NULL) end |