Class: KairosMcp::Tools::KnowledgeUpdate
- Defined in:
- lib/kairos_mcp/tools/knowledge_update.rb
Instance Method Summary collapse
- #call(arguments) ⇒ Object
- #category ⇒ Object
- #description ⇒ Object
- #examples ⇒ Object
- #input_schema ⇒ Object
- #name ⇒ Object
- #related_tools ⇒ Object
- #usecase_tags ⇒ Object
Methods inherited from BaseTool
#harness_requirement, #initialize, #invoke_tool, #to_full_schema, #to_schema
Constructor Details
This class inherits a constructor from KairosMcp::Tools::BaseTool
Instance Method Details
#call(arguments) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/kairos_mcp/tools/knowledge_update.rb', line 79 def call(arguments) command = arguments['command'] name = arguments['name'] content = arguments['content'] reason = arguments['reason'] create_subdirs = arguments['create_subdirs'] || false return text_content("Error: name is required") unless name && !name.empty? # Check if L1 layer is enabled unless SkillsConfig.layer_enabled?(:L1) return text_content("Error: L1 (knowledge) layer is disabled") end provider = KnowledgeProvider.new(nil, user_context: @safety&.current_user) case command when 'create' handle_create(provider, name, content, reason, create_subdirs) when 'update' handle_update(provider, name, content, reason) when 'delete' handle_delete(provider, name, reason) else text_content("Unknown command: #{command}") end end |
#category ⇒ Object
20 21 22 |
# File 'lib/kairos_mcp/tools/knowledge_update.rb', line 20 def category :knowledge end |
#description ⇒ Object
14 15 16 17 18 |
# File 'lib/kairos_mcp/tools/knowledge_update.rb', line 14 def description 'Create, update, or delete L1 knowledge skills. Changes are recorded with hash references to the blockchain. ' \ 'NOTE: MCP stdio transport may silently drop large arguments. Keep combined content + reason under ~2 KB. ' \ 'For larger L1 entries, trim prose or split into multiple entries.' end |
#examples ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/kairos_mcp/tools/knowledge_update.rb', line 28 def examples [ { title: 'Create new knowledge', code: 'knowledge_update(command: "create", name: "api_guidelines", content: "---\nname: api_guidelines\ndescription: API design rules\n---\n# API Guidelines\n...")' }, { title: 'Update existing knowledge', code: 'knowledge_update(command: "update", name: "api_guidelines", content: "...", reason: "Added auth section")' }, { title: 'Delete knowledge', code: 'knowledge_update(command: "delete", name: "old_rule", reason: "No longer applicable")' } ] end |
#input_schema ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/kairos_mcp/tools/knowledge_update.rb', line 49 def input_schema { type: 'object', properties: { command: { type: 'string', description: 'Command: "create", "update", or "delete"', enum: %w[create update delete] }, name: { type: 'string', description: 'Knowledge skill name' }, content: { type: 'string', description: 'Full content including YAML frontmatter (for create/update)' }, reason: { type: 'string', description: 'Reason for the change (recorded in blockchain)' }, create_subdirs: { type: 'boolean', description: 'Create scripts/assets/references subdirectories (for create, default: false)' } }, required: %w[command name] } end |
#name ⇒ Object
10 11 12 |
# File 'lib/kairos_mcp/tools/knowledge_update.rb', line 10 def name 'knowledge_update' end |
#related_tools ⇒ Object
45 46 47 |
# File 'lib/kairos_mcp/tools/knowledge_update.rb', line 45 def %w[knowledge_list knowledge_get context_save skills_promote] end |
#usecase_tags ⇒ Object
24 25 26 |
# File 'lib/kairos_mcp/tools/knowledge_update.rb', line 24 def %w[save update delete L1 knowledge project permanent] end |