Class: KairosMcp::Tools::ResourceList
- Inherits:
-
BaseTool
- Object
- BaseTool
- KairosMcp::Tools::ResourceList
show all
- Defined in:
- lib/kairos_mcp/tools/resource_list.rb
Overview
ResourceList: List available resources across all layers (L0/L1/L2)
Provides unified access to discover resources via URI-based system. Use resource_read to fetch content of discovered resources.
Instance Method Summary
collapse
Methods inherited from BaseTool
#initialize, #invoke_tool, #to_full_schema, #to_schema
Instance Method Details
#call(arguments) ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/kairos_mcp/tools/resource_list.rb', line 77
def call(arguments)
filter = arguments['filter']
type = arguments['type'] || 'all'
layer = arguments['layer'] || 'all'
registry = ResourceRegistry.new(user_context: @safety&.current_user)
resources = registry.list(filter: filter, type: type, layer: layer)
if resources.empty?
return text_content(build_empty_response(filter, type, layer))
end
text_content(build_response(resources, filter, type, layer))
end
|
#category ⇒ Object
25
26
27
|
# File 'lib/kairos_mcp/tools/resource_list.rb', line 25
def category
:resource
end
|
#description ⇒ Object
18
19
20
21
22
23
|
# File 'lib/kairos_mcp/tools/resource_list.rb', line 18
def description
'List available resources across all layers (L0/L1/L2). ' \
'Returns URIs that can be read with resource_read. ' \
'Resources include skills (L0), knowledge files/scripts/assets (L1), ' \
'and context files/scripts/assets (L2).'
end
|
#examples ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/kairos_mcp/tools/resource_list.rb', line 33
def examples
[
{
title: 'List all resources',
code: 'resource_list()'
},
{
title: 'Filter by layer',
code: 'resource_list(layer: "l1")'
},
{
title: 'Filter by type',
code: 'resource_list(type: "scripts")'
}
]
end
|
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/kairos_mcp/tools/resource_list.rb', line 54
def input_schema
{
type: 'object',
properties: {
filter: {
type: 'string',
description: 'Filter resources: "l0", "knowledge", "context", ' \
'or a specific name like "example_knowledge" or "session_xxx/context_name"'
},
type: {
type: 'string',
enum: %w[all md scripts assets references],
description: 'Filter by resource type. Default: "all"'
},
layer: {
type: 'string',
enum: %w[all l0 l1 l2],
description: 'Filter by layer. Default: "all"'
}
}
}
end
|
#name ⇒ Object
14
15
16
|
# File 'lib/kairos_mcp/tools/resource_list.rb', line 14
def name
'resource_list'
end
|
50
51
52
|
# File 'lib/kairos_mcp/tools/resource_list.rb', line 50
def related_tools
%w[resource_read knowledge_list skills_list]
end
|
29
30
31
|
# File 'lib/kairos_mcp/tools/resource_list.rb', line 29
def usecase_tags
%w[list resources L0 L1 L2 discover browse URI]
end
|