Module: ActionMCP::MimeTypes

Defined in:
lib/action_mcp/mime_types.rb

Overview

Engine-owned MIME type registry. Keeps protocol-level MIME values out of Rails’ global ‘Mime::Type` registry while still letting the DSL accept short symbols. For symbols not in our table, falls back to Rails’ global registry so apps can still use their own registered formats.

Constant Summary collapse

APP_HTML =

MCP Apps (ext-apps, SEP-1865)

"text/html;profile=mcp-app"
TYPES =
{
  mcp_app: APP_HTML
}.freeze

Class Method Summary collapse

Class Method Details

.resolve(value) ⇒ String

Resolve a user-supplied MIME value to a wire string.

Parameters:

  • value (Symbol, String, Mime::Type)

Returns:

  • (String)


19
20
21
22
23
24
25
26
27
28
# File 'lib/action_mcp/mime_types.rb', line 19

def self.resolve(value)
  case value
  when Symbol
    TYPES[value] || Mime[value]&.to_s || raise(KeyError, "unknown MIME type: #{value.inspect}")
  when Mime::Type
    value.to_s
  else
    value.to_s
  end
end