Class: KairosMcp::Tools::BaseTool
- Inherits:
-
Object
- Object
- KairosMcp::Tools::BaseTool
- Defined in:
- lib/kairos_mcp/tools/base_tool.rb
Direct Known Subclasses
SkillToolAdapter, ChainExport, ChainHistory, ChainImport, ChainRecord, ChainStatus, ChainVerify, ContextCreateSubdir, ContextSave, DefinitionDecompile, DefinitionDrift, DefinitionVerify, FormalizationHistory, FormalizationRecord, HelloWorld, InstructionsUpdate, KnowledgeGet, KnowledgeList, KnowledgeUpdate, ResourceList, ResourceRead, SkillsAudit, SkillsDslGet, SkillsDslList, SkillsEvolve, SkillsGet, SkillsList, SkillsPromote, SkillsRollback, StateCommit, StateHistory, StateStatus, SystemUpgrade, TokenManage, ToolGuide
Instance Method Summary collapse
- #call(arguments) ⇒ Object
-
#category ⇒ Symbol
Category for grouping tools in catalog.
- #description ⇒ Object
-
#examples ⇒ Array<Hash>
Usage examples for this tool.
-
#initialize(safety = nil, registry: nil) ⇒ BaseTool
constructor
A new instance of BaseTool.
- #input_schema ⇒ Object
-
#invoke_tool(tool_name, arguments = {}, context: nil) ⇒ Object
Invoke another tool through the same ToolRegistry, preserving the full gate pipeline and invocation policy (whitelist/blacklist/depth).
- #name ⇒ Object
-
#related_tools ⇒ Array<String>
Related tools that are often used together.
-
#to_full_schema ⇒ Object
Extended schema including metadata (for internal use).
-
#to_schema ⇒ Object
Schema for MCP protocol.
-
#usecase_tags ⇒ Array<String>
Tags for keyword-based search and recommendations.
Constructor Details
#initialize(safety = nil, registry: nil) ⇒ BaseTool
Returns a new instance of BaseTool.
6 7 8 9 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 6 def initialize(safety = nil, registry: nil) @safety = safety @registry = registry end |
Instance Method Details
#call(arguments) ⇒ Object
40 41 42 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 40 def call(arguments) raise NotImplementedError end |
#category ⇒ Symbol
Category for grouping tools in catalog
49 50 51 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 49 def category :utility end |
#description ⇒ Object
32 33 34 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 32 def description raise NotImplementedError end |
#examples ⇒ Array<Hash>
Usage examples for this tool
61 62 63 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 61 def examples [] end |
#input_schema ⇒ Object
36 37 38 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 36 def input_schema raise NotImplementedError end |
#invoke_tool(tool_name, arguments = {}, context: nil) ⇒ Object
Invoke another tool through the same ToolRegistry, preserving the full gate pipeline and invocation policy (whitelist/blacklist/depth). Only available when the tool was registered with a registry reference.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 14 def invoke_tool(tool_name, arguments = {}, context: nil) raise "Tool invocation not available (no registry)" unless @registry ctx = context || InvocationContext.new child_ctx = ctx.child(caller_tool: name) unless child_ctx.allowed?(tool_name) raise InvocationContext::PolicyDeniedError, "Tool '#{tool_name}' blocked by invocation policy (caller: #{name})" end @registry.call_tool(tool_name, arguments, invocation_context: child_ctx) end |
#name ⇒ Object
28 29 30 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 28 def name raise NotImplementedError end |
#related_tools ⇒ Array<String>
Related tools that are often used together
67 68 69 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 67 def [] end |
#to_full_schema ⇒ Object
Extended schema including metadata (for internal use)
81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 81 def to_full_schema { name: name, description: description, inputSchema: input_schema, _metadata: { category: category, usecase_tags: , examples: examples, related_tools: } } end |
#to_schema ⇒ Object
Schema for MCP protocol
72 73 74 75 76 77 78 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 72 def to_schema { name: name, description: description, inputSchema: input_schema } end |
#usecase_tags ⇒ Array<String>
Tags for keyword-based search and recommendations
55 56 57 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 55 def [] end |