class Rubydex::MCPServer::Tool
Attributes
Public Class Methods
(?String) → String
Source
# File lib/rubydex/mcp_server/protocol.rb, line 94 def description(value = nil) @description = value if value @description || raise(NotImplementedError, "#{name} must define description") end
(Class) → void
Source
# File lib/rubydex/mcp_server/protocol.rb, line 77 def inherited(tool) Tool.tools << tool unless tool.name&.end_with?("::BaseTool") super end
Calls superclass method
(?Hash, ?Array[String]) → Hash
Source
# File lib/rubydex/mcp_server/protocol.rb, line 100 def input_schema(properties: nil, required: nil) if properties @input_schema = { type: "object", properties: properties, } @input_schema[:required] = required if required end @input_schema || { type: "object", properties: {} } end
→ Hash
Source
# File lib/rubydex/mcp_server/protocol.rb, line 113 def to_h { name: tool_name, description: description, inputSchema: input_schema, } end
(?String) → String
Source
# File lib/rubydex/mcp_server/protocol.rb, line 88 def tool_name(value = nil) @tool_name = value if value @tool_name || raise(NotImplementedError, "#{name} must define tool_name") end
→ Hash[String, Class]
Source
# File lib/rubydex/mcp_server/protocol.rb, line 83 def tools_by_name tools.to_h { |tool| [tool.tool_name, tool] } end