Class: MockServer::MCP::McpToolBuilder
- Inherits:
-
Object
- Object
- MockServer::MCP::McpToolBuilder
- Defined in:
- lib/mockserver/mcp.rb
Instance Method Summary collapse
-
#and_then ⇒ McpMockBuilder
(also: #and_)
Commit the tool and return to the root builder.
-
#initialize(parent, name) ⇒ McpToolBuilder
constructor
A new instance of McpToolBuilder.
- #responding_with(text_content, is_error = false) ⇒ self
- #with_description(description) ⇒ self
- #with_input_schema(json_schema) ⇒ self
Constructor Details
#initialize(parent, name) ⇒ McpToolBuilder
Returns a new instance of McpToolBuilder.
344 345 346 347 |
# File 'lib/mockserver/mcp.rb', line 344 def initialize(parent, name) @parent = parent @tool = ToolDef.new(name, nil, nil, nil, false) end |
Instance Method Details
#and_then ⇒ McpMockBuilder Also known as: and_
Commit the tool and return to the root builder.
370 371 372 373 |
# File 'lib/mockserver/mcp.rb', line 370 def and_then @parent.add_tool(@tool) @parent end |
#responding_with(text_content, is_error = false) ⇒ self
362 363 364 365 366 |
# File 'lib/mockserver/mcp.rb', line 362 def responding_with(text_content, is_error = false) @tool.response_content = text_content @tool.response_is_error = is_error self end |
#with_description(description) ⇒ self
350 351 352 353 |
# File 'lib/mockserver/mcp.rb', line 350 def with_description(description) @tool.description = description self end |
#with_input_schema(json_schema) ⇒ self
356 357 358 359 |
# File 'lib/mockserver/mcp.rb', line 356 def with_input_schema(json_schema) @tool.input_schema = json_schema self end |