actionmcp 0.110.0 → 0.110.1

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: b49e1bd20853c60ec17b35b3ba822a275b8258800ce615707dcf85ecaa606dc8
4
- data.tar.gz: c1abbbe666dbea818abde461aaae5d65f867700fa96e6d5c8011b12b10be1fcd
3
+ metadata.gz: 8d42c4cca6055186c9f9b7e586eae350da05e54418bf7a1c5017bfeb5a7ac192
4
+ data.tar.gz: 4e33174b5d925280c963f973fa342447379bff27caeddcbaa7b39909109c420b
5
5
  SHA512:
6
- metadata.gz: 984a0a14b69ed4684ee7054db880320711c18613d4f5242922ac6eeb6946fb4c21954831c4ac935796f234f3abf8e691bc24c8ab219910fce8f9dd7a77600828
7
- data.tar.gz: 8356febeb0097488d56a50e42160cf09c5e9be1e9952bf170fefb6f56e991079efc183bbca2e2080d2d3d9406c21a57e9211888eee405171bc4730903904559e
6
+ metadata.gz: 3122421b19a6fba275f2508237b8c241f8baecefac049f6ba30c08a8c4bc70c1831a3e6fe46983e6fe4368bb55d5bf4b1e5823d606df9d6b485cb47e3bb966af
7
+ data.tar.gz: 32f4cb79bb1a4f591f6f074d59fa8f4f9575fa2d559a970ef5fb92a04f8a589f89b315619b03d323d544377c4c945bd87a04eb84280c376c17c77ef431357c6f
@@ -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
@@ -343,7 +343,15 @@ module ActionMCP
343
343
  if text
344
344
  text
345
345
  elsif template
346
- ApplicationController.render(template: template, layout: layout, locals: locals)
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "gem_version"
4
4
  module ActionMCP
5
- VERSION = "0.110.0"
5
+ VERSION = "0.110.1"
6
6
 
7
7
  class << self
8
8
  alias version gem_version
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.0
4
+ version: 0.110.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
@@ -149,6 +149,7 @@ files:
149
149
  - README.md
150
150
  - Rakefile
151
151
  - app/controllers/action_mcp/application_controller.rb
152
+ - app/controllers/action_mcp/mcp_app_renderer.rb
152
153
  - app/jobs/action_mcp/tool_execution_job.rb
153
154
  - app/models/action_mcp.rb
154
155
  - app/models/action_mcp/application_record.rb