Class: Ask::WebSearch::MCP::Tool
- Inherits:
-
Object
- Object
- Ask::WebSearch::MCP::Tool
- Defined in:
- lib/ask/web_search/mcp/tool.rb
Overview
The ask_web_search tool, duck-typed for Ask::MCP's ToolServer adapter (name / description / params_schema / call). The tool framing lives with its consumer — this server — not in the library: the capability is Ask::WebSearch.search, this is the agent-facing shell around it.
Instance Method Summary collapse
-
#call(args) ⇒ Object
Returns the formatted results (a String is a success for the adapter) or raises on connection/HTTP failures — the adapter surfaces them as classed errors.
- #description ⇒ Object
- #name ⇒ Object
- #params_schema ⇒ Object
Instance Method Details
#call(args) ⇒ Object
Returns the formatted results (a String is a success for the adapter) or raises on connection/HTTP failures — the adapter surfaces them as classed errors.
35 36 37 38 39 40 |
# File 'lib/ask/web_search/mcp/tool.rb', line 35 def call(args) query = args["query"].to_s raise ArgumentError, "missing required parameter: query" if query.empty? Ask::WebSearch.search(query) end |
#description ⇒ Object
18 19 20 |
# File 'lib/ask/web_search/mcp/tool.rb', line 18 def description "Search the web for current information. Use this to get up-to-date results, recent events, or facts that may have changed." end |
#name ⇒ Object
14 15 16 |
# File 'lib/ask/web_search/mcp/tool.rb', line 14 def name "ask_web_search" end |
#params_schema ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/ask/web_search/mcp/tool.rb', line 22 def params_schema { "type" => "object", "properties" => { "query" => { "type" => "string", "description" => "The search query" } }, "required" => ["query"] } end |