Class: KairosMcp::Tools::ResourceRead
- Inherits:
-
BaseTool
- Object
- BaseTool
- KairosMcp::Tools::ResourceRead
show all
- Defined in:
- lib/kairos_mcp/tools/resource_read.rb
Overview
ResourceRead: Read a resource by URI
Fetches content from any layer using the unified URI scheme. Use resource_list to discover available URIs.
Instance Method Summary
collapse
Methods inherited from BaseTool
#initialize, #invoke_tool, #to_full_schema, #to_schema
Instance Method Details
#call(arguments) ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/kairos_mcp/tools/resource_read.rb', line 68
def call(arguments)
uri = arguments['uri']
return text_content('Error: uri is required') unless uri && !uri.empty?
registry = ResourceRegistry.new(user_context: @safety&.current_user)
resource = registry.read(uri)
if resource.nil?
return text_content(build_not_found_response(uri))
end
text_content(build_response(resource))
end
|
#category ⇒ Object
23
24
25
|
# File 'lib/kairos_mcp/tools/resource_read.rb', line 23
def category
:resource
end
|
#description ⇒ Object
18
19
20
21
|
# File 'lib/kairos_mcp/tools/resource_read.rb', line 18
def description
'Read a resource by URI. Use resource_list to discover available URIs. ' \
'Supports L0 (l0://), L1 knowledge (knowledge://), and L2 context (context://) resources.'
end
|
#examples ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/kairos_mcp/tools/resource_read.rb', line 31
def examples
[
{
title: 'Read L0 skill',
code: 'resource_read(uri: "l0://kairos.md")'
},
{
title: 'Read L1 knowledge',
code: 'resource_read(uri: "knowledge://api_guidelines")'
},
{
title: 'Read script from knowledge',
code: 'resource_read(uri: "knowledge://deployment/scripts/deploy.sh")'
}
]
end
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/kairos_mcp/tools/resource_read.rb', line 52
def input_schema
{
type: 'object',
properties: {
uri: {
type: 'string',
description: 'Resource URI. Examples: ' \
'"l0://kairos.md", "knowledge://example_knowledge", ' \
'"knowledge://example_knowledge/scripts/test.sh", ' \
'"context://session_id/context_name"'
}
},
required: ['uri']
}
end
|
#name ⇒ Object
14
15
16
|
# File 'lib/kairos_mcp/tools/resource_read.rb', line 14
def name
'resource_read'
end
|
48
49
50
|
# File 'lib/kairos_mcp/tools/resource_read.rb', line 48
def related_tools
%w[resource_list knowledge_get skills_get]
end
|
27
28
29
|
# File 'lib/kairos_mcp/tools/resource_read.rb', line 27
def usecase_tags
%w[read get content URI L0 L1 L2 fetch]
end
|