Class: Clacky::Mcp::VirtualSkill

Inherits:
Skill
  • Object
show all
Defined in:
lib/clacky/mcp/virtual_skill.rb

Overview

In-memory Skill that surfaces a configured MCP server in the agent’s AVAILABLE MCP SERVERS section. When invoked, it forks a subagent whose only job is to operate this server.

The subagent does NOT receive a Ruby-side bridge tool. It calls the server through the local Clacky HTTP API using whichever shell-style tool is already available (curl + the ‘terminal` tool, etc.). This makes MCP indistinguishable from any other skill at the system-prompt level —there is no second layer for the LLM to misunderstand.

Constant Summary

Constants inherited from Skill

Skill::DESCRIPTION_MAX_CHARS, Skill::FRONTMATTER_FIELDS

Instance Attribute Summary collapse

Attributes inherited from Skill

#agent_type, #allowed_tools, #argument_hint, #auto_summarize, #brand_config, #brand_skill, #content, #context, #description, #description_zh, #directory, #disable_model_invocation, #forbidden_tools, #fork_agent, #frontmatter, #hooks, #invalid, #invalid_reason, #model, #name, #name_zh, #source, #source_path, #user_invocable, #warnings

Instance Method Summary collapse

Methods inherited from Skill

#agents_scope, #allowed_for_agent?, #auto_summarize?, #context_description, #decrypted_content, #disabled?, #expand_templates, #extract_first_paragraph, #forbidden_tools_list, #fork_agent?, #has_warnings?, #identifier, #invalid?, #load_skill, #model_invocation_allowed?, #parse_frontmatter, #read_supporting_file, #sanitize_frontmatter, #slash_command, #subagent_model, #user_invocable?

Constructor Details

#initialize(server_name:, description:) ⇒ VirtualSkill

Returns a new instance of VirtualSkill.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/clacky/mcp/virtual_skill.rb', line 19

def initialize(server_name:, description:)
  @mcp_server_name = server_name

  @directory       = Pathname.new("/dev/null/mcp/#{server_name}")
  @source_path     = @directory
  @brand_skill     = false
  @brand_config    = nil
  @cached_metadata = nil
  @encrypted       = false
  @warnings        = []
  @invalid         = false
  @invalid_reason  = nil
  @frontmatter     = {}

  @name        = "mcp:#{server_name}"
  @description = description
  @name_zh        = nil
  @description_zh = nil

  @user_invocable           = true
  @disable_model_invocation = false
  @allowed_tools  = nil
  @context        = nil
  @agent_type     = nil
  @argument_hint  = nil
  @hooks          = nil
  @fork_agent     = true
  @model          = nil
  @forbidden_tools = nil
  @auto_summarize = true

  @content = build_content
end

Instance Attribute Details

#mcp_server_nameObject (readonly)

Returns the value of attribute mcp_server_name.



17
18
19
# File 'lib/clacky/mcp/virtual_skill.rb', line 17

def mcp_server_name
  @mcp_server_name
end

Instance Method Details

#encrypted?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/clacky/mcp/virtual_skill.rb', line 53

def encrypted?
  false
end

#has_supporting_files?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/clacky/mcp/virtual_skill.rb', line 57

def has_supporting_files?
  false
end

#process_content(shell_output: {}, template_context: {}, script_dir: nil) ⇒ Object



65
66
67
# File 'lib/clacky/mcp/virtual_skill.rb', line 65

def process_content(shell_output: {}, template_context: {}, script_dir: nil)
  @content
end

#supporting_filesObject



61
62
63
# File 'lib/clacky/mcp/virtual_skill.rb', line 61

def supporting_files
  []
end

#to_hObject



69
70
71
# File 'lib/clacky/mcp/virtual_skill.rb', line 69

def to_h
  super.merge(mcp: true, mcp_server: @mcp_server_name)
end