Module: ActionModelContext::TestHelper

Defined in:
lib/action_model_context/test_helper.rb

Overview

Runs a tool in a test through a real MCP::Server, so argument validation and error handling behave as in production.

Examples:

include ActionModelContext::TestHelper

result = call_tool(EchoTool, message: 'hi', times: 2)
result.text #=> 'hihi'

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Instance Method Details

#call_tool(tool_class, context: {}, **arguments) ⇒ Result

Calls a tool. An unexpected exception raised by the tool is raised again here.

Parameters:

  • tool_class (Class) —
  • context (Object) (defaults to: {}) —

    the context given to the tool

  • arguments (Hash) —

    the arguments of the tool

Returns: