actionmcp 0.110.0 → 0.110.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f18a19a33b307301a158d77b9fb5bfede2a9dfa9f3d316be439db3f58b313b6b
|
|
4
|
+
data.tar.gz: 5623ce4489efa81032fac7c1a9baad1a6ebe27b74593d6a25b022143f2d40d0c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fe04793ecfdad4d4c90041d3834b52fdf0956b152c51a4c5a866380bba60d327c560c427962eaac2259c6087a22daa7d97244adc75a5f7e7099ae0a37ec44fbf
|
|
7
|
+
data.tar.gz: 75ece96abe7f14658da802e3b295cb085bd7c736e900a7339f42c91b65c1ddd2422e10c650bac99121201ccd1b3abaaa0a39c2ad4665bafc5f7748493ce45a5c
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ActionMCP
|
|
4
|
+
# Internal renderer for `ResourceTemplate#render_ui(template:)`, the entry
|
|
5
|
+
# point for MCP Apps UI views.
|
|
6
|
+
#
|
|
7
|
+
# Inherits from `ActionController::Base` so it always carries the full
|
|
8
|
+
# ActionView stack regardless of whether the host Rails app is API-only.
|
|
9
|
+
# Decoupling from the host's `ApplicationController` ensures `render_ui`
|
|
10
|
+
# produces a non-empty body under `config.api_only = true`.
|
|
11
|
+
#
|
|
12
|
+
# Note: templates rendered through this controller intentionally do NOT
|
|
13
|
+
# inherit host `ApplicationController` filters or `helper_method` exposure
|
|
14
|
+
# (e.g., `current_user`). That decoupling is what makes `render_ui` work in
|
|
15
|
+
# API-only hosts; reintroducing host coupling would bring the bug back.
|
|
16
|
+
# Pass any data the template needs via the `locals:` argument to
|
|
17
|
+
# `ResourceTemplate#render_ui`.
|
|
18
|
+
#
|
|
19
|
+
# Not routed. Not intended to be subclassed or used directly by host apps.
|
|
20
|
+
class MCPAppRenderer < ActionController::Base
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -474,35 +474,8 @@ module ActionMCP
|
|
|
474
474
|
# Only load if we haven't loaded yet - but in development, always reload
|
|
475
475
|
return if @mcp_components_loaded && !Rails.env.development?
|
|
476
476
|
|
|
477
|
-
# Use Zeitwerk eager loading if available (in to_prepare phase)
|
|
478
477
|
mcp_path = Rails.root.join("app/mcp")
|
|
479
|
-
|
|
480
|
-
# This will trigger all inherited hooks properly
|
|
481
|
-
Rails.autoloaders.main.eager_load_dir(mcp_path)
|
|
482
|
-
elsif mcp_path.exist?
|
|
483
|
-
# Fallback for initialization phase - use require_dependency
|
|
484
|
-
# Load base classes first in specific order
|
|
485
|
-
base_files = [
|
|
486
|
-
mcp_path.join("application_gateway.rb"),
|
|
487
|
-
mcp_path.join("tools/application_mcp_tool.rb"),
|
|
488
|
-
mcp_path.join("prompts/application_mcp_prompt.rb"),
|
|
489
|
-
mcp_path.join("resource_templates/application_mcp_res_template.rb"),
|
|
490
|
-
# Load ArithmeticTool before other tools that inherit from it
|
|
491
|
-
mcp_path.join("tools/arithmetic_tool.rb")
|
|
492
|
-
]
|
|
493
|
-
|
|
494
|
-
base_files.each do |file|
|
|
495
|
-
require_dependency file.to_s if file.exist?
|
|
496
|
-
end
|
|
497
|
-
|
|
498
|
-
# Then load all other files
|
|
499
|
-
Dir.glob(mcp_path.join("**/*.rb")).sort.each do |file|
|
|
500
|
-
# Skip base classes we already loaded
|
|
501
|
-
next if base_files.any? { |base| file == base.to_s }
|
|
502
|
-
|
|
503
|
-
require_dependency file
|
|
504
|
-
end
|
|
505
|
-
end
|
|
478
|
+
Rails.autoloaders.main.eager_load_dir(mcp_path) if mcp_path.exist?
|
|
506
479
|
@mcp_components_loaded = true unless Rails.env.development?
|
|
507
480
|
end
|
|
508
481
|
end
|
|
@@ -343,7 +343,15 @@ module ActionMCP
|
|
|
343
343
|
if text
|
|
344
344
|
text
|
|
345
345
|
elsif template
|
|
346
|
-
|
|
346
|
+
rendered = ActionMCP::MCPAppRenderer.render(template: template, layout: layout, locals: locals)
|
|
347
|
+
if rendered.to_s.strip.empty?
|
|
348
|
+
ActionMCP.logger.warn(
|
|
349
|
+
"[ActionMCP] render_ui produced empty output for #{self.class.name} " \
|
|
350
|
+
"(uri_template=#{self.class.uri_template.inspect}, template=#{template.inspect}). " \
|
|
351
|
+
"Check the template path and host view configuration."
|
|
352
|
+
)
|
|
353
|
+
end
|
|
354
|
+
rendered
|
|
347
355
|
else
|
|
348
356
|
raise ArgumentError, "render_ui requires :text or :template"
|
|
349
357
|
end
|
data/lib/action_mcp/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: actionmcp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.110.
|
|
4
|
+
version: 0.110.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Abdelkader Boudih
|
|
@@ -97,16 +97,22 @@ dependencies:
|
|
|
97
97
|
name: zeitwerk
|
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
|
-
- - "
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: 2.6.2
|
|
103
|
+
- - "<"
|
|
101
104
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
105
|
+
version: '3.0'
|
|
103
106
|
type: :runtime
|
|
104
107
|
prerelease: false
|
|
105
108
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
109
|
requirements:
|
|
107
|
-
- - "
|
|
110
|
+
- - ">="
|
|
111
|
+
- !ruby/object:Gem::Version
|
|
112
|
+
version: 2.6.2
|
|
113
|
+
- - "<"
|
|
108
114
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '
|
|
115
|
+
version: '3.0'
|
|
110
116
|
- !ruby/object:Gem::Dependency
|
|
111
117
|
name: state_machines-activerecord
|
|
112
118
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -149,6 +155,7 @@ files:
|
|
|
149
155
|
- README.md
|
|
150
156
|
- Rakefile
|
|
151
157
|
- app/controllers/action_mcp/application_controller.rb
|
|
158
|
+
- app/controllers/action_mcp/mcp_app_renderer.rb
|
|
152
159
|
- app/jobs/action_mcp/tool_execution_job.rb
|
|
153
160
|
- app/models/action_mcp.rb
|
|
154
161
|
- app/models/action_mcp/application_record.rb
|
|
@@ -300,7 +307,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
300
307
|
- !ruby/object:Gem::Version
|
|
301
308
|
version: '0'
|
|
302
309
|
requirements: []
|
|
303
|
-
rubygems_version: 4.0.
|
|
310
|
+
rubygems_version: 4.0.10
|
|
304
311
|
specification_version: 4
|
|
305
312
|
summary: Lightweight Model Context Protocol (MCP) server toolkit for Ruby/Rails
|
|
306
313
|
test_files: []
|