Class: MockServer::MCP::McpToolBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/mockserver/mcp.rb

Instance Method Summary collapse

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_thenMcpMockBuilder Also known as: and_

Commit the tool and return to the root builder.

Returns:



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

Returns:

  • (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

Returns:

  • (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

Returns:

  • (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