4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/scout/llm/mcp.rb', line 4
def mcp(*tasks)
tasks = tasks.flatten.compact
tasks = self.tasks.keys if tasks.empty?
tools = tasks.collect do |task,inputs=nil|
tool_definition = LLM.task_tool_definition(self, task, inputs)
description = tool_definition[:description]
input_schema = tool_definition[:parameters].slice(:properties, :required)
annotations = tool_definition.slice(:title)
annotations[:read_only_hint] = true
annotations[:destructive_hint] = false
annotations[:idempotent_hint] = true
annotations[:open_world_hint] = false
MCP::Tool.define(name:task, description: description, input_schema: input_schema, annotations:annotations) do |parameters,context|
self.job(name, parameters).run
end
end
version = "1.0.0"
MCP::Server.new(
name: self.name,
version: version,
tools: tools
)
end
|