Class: KairosMcp::Tools::BaseTool
- Inherits:
-
Object
- Object
- KairosMcp::Tools::BaseTool
- Defined in:
- lib/kairos_mcp/tools/base_tool.rb
Direct Known Subclasses
SkillToolAdapter, CapabilityStatus, 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.
-
#harness_requirement ⇒ Symbol, Hash
Phase 1.5 — Capability Boundary self-articulation.
-
#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.
7 8 9 10 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 7 def initialize(safety = nil, registry: nil) @safety = safety @registry = registry end |
Instance Method Details
#call(arguments) ⇒ Object
41 42 43 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 41 def call(arguments) raise NotImplementedError end |
#category ⇒ Symbol
Category for grouping tools in catalog
50 51 52 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 50 def category :utility end |
#description ⇒ Object
33 34 35 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 33 def description raise NotImplementedError end |
#examples ⇒ Array<Hash>
Usage examples for this tool
62 63 64 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 62 def examples [] end |
#harness_requirement ⇒ Symbol, Hash
Phase 1.5 — Capability Boundary self-articulation. Override in subclasses to declare harness dependence. Default :core means MCP + filesystem only, no subprocess, no harness-specific tool. See docs/drafts/capability_boundary_design_v1.1.md for the 8 invariants and tier rules.
80 81 82 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 80 def harness_requirement :core end |
#input_schema ⇒ Object
37 38 39 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 37 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.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 15 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
29 30 31 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 29 def name raise NotImplementedError end |
#related_tools ⇒ Array<String>
Related tools that are often used together
68 69 70 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 68 def [] end |
#to_full_schema ⇒ Object
Extended schema including metadata (for internal use)
94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 94 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
85 86 87 88 89 90 91 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 85 def to_schema { name: name, description: description, inputSchema: input_schema } end |
#usecase_tags ⇒ Array<String>
Tags for keyword-based search and recommendations
56 57 58 |
# File 'lib/kairos_mcp/tools/base_tool.rb', line 56 def [] end |