Module: RubynCode::MCP::ServerExtrasBridge
- Defined in:
- lib/rubyn_code/mcp/server_extras_bridge.rb
Overview
Bridges an MCP server’s resources and prompts into native RubynCode tools — the non-“tools” half of the MCP surface. Split out of ToolBridge so tool bridging and resource/prompt bridging each stay one focused job.
Each capability registers a single tool whose description lists what’s available (resource URIs / prompt names) and reads or fetches any of them.
Class Method Summary collapse
-
.bridge_prompts(mcp_client) ⇒ Array<Class>
If the server exposes prompts, register one tool that lists the available prompt names and fetches any of them (with arguments).
-
.bridge_resources(mcp_client) ⇒ Array<Class>
If the server exposes resources, register one tool that lists the available URIs (in its description) and reads any of them.
Class Method Details
.bridge_prompts(mcp_client) ⇒ Array<Class>
If the server exposes prompts, register one tool that lists the available prompt names and fetches any of them (with arguments).
30 31 32 33 34 35 36 37 |
# File 'lib/rubyn_code/mcp/server_extras_bridge.rb', line 30 def bridge_prompts(mcp_client) prompts = safe_list(mcp_client, :prompts) return [] if prompts.empty? klass = create_prompt_tool(mcp_client, prompts) Tools::Registry.register(klass) [klass] end |
.bridge_resources(mcp_client) ⇒ Array<Class>
If the server exposes resources, register one tool that lists the available URIs (in its description) and reads any of them.
17 18 19 20 21 22 23 24 |
# File 'lib/rubyn_code/mcp/server_extras_bridge.rb', line 17 def bridge_resources(mcp_client) resources = safe_list(mcp_client, :resources) return [] if resources.empty? klass = create_resource_tool(mcp_client, resources) Tools::Registry.register(klass) [klass] end |