explicit 0.2.17 → 0.2.19

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: 28e91e624223bafc22d197130a6ae5973f6a2364f6dd192d8e2f70b74fe88968
4
- data.tar.gz: 3fcacbe34bd45dc3b988f703f05928a65af46f284b498a64e83f12539cc2ef86
3
+ metadata.gz: 2be9f58389c8a9d5478bf8c0604b89ce308d90ad44e1f053ed9ad6565dd85ecb
4
+ data.tar.gz: cb2aa01a9ae758d3247db1f5379456f4c9711a4153fd965bb1baf9bf459f0518
5
5
  SHA512:
6
- metadata.gz: bc53aeced2b49c6667fb723a681d8e01b8e2529713a07f142281d2b2bcd40dc619c435c08ad7d7aee38aeceac7e053fd2d46a8e2d438bf82211a4fbd63ba12b7
7
- data.tar.gz: cf4995522dab379e5277ac328e55968d0bc30b8850d64fcf7fb25b7afb9eae0c0c865df0813b7578dbff0d91f179b10a32e51b4c9b797932ab1aec95091c54ba
6
+ metadata.gz: c726fe0a4e25152e827c478628562c7af69e263af082229af8b6de361a1144f44bb8799f7ed3b78a95899594fe18867e1f3bdaca882c722a54f393477f6985de
7
+ data.tar.gz: 564654b46d1681986dbbf4c8cfd1da706606c9290332230a507ad5cac21a5d845b9f96a92b0fcb0012205d8721fc59a77810962ccd4641c8c951e5d0543a919c
@@ -158,7 +158,7 @@ module Explicit::Documentation::Output
158
158
  in: "header",
159
159
  required: type.required?,
160
160
  schema: type.swagger_schema,
161
- style: "simple"
161
+ style: "form"
162
162
  }
163
163
  end
164
164
 
@@ -169,7 +169,7 @@ module Explicit::Documentation::Output
169
169
  in: "path",
170
170
  required: type.required?,
171
171
  schema: type.swagger_schema,
172
- style: "simple"
172
+ style: "form"
173
173
  }
174
174
  end
175
175
 
@@ -180,7 +180,7 @@ module Explicit::Documentation::Output
180
180
  in: "query",
181
181
  required: type.required?,
182
182
  schema: type.swagger_schema,
183
- style: "simple"
183
+ style: "form"
184
184
  }
185
185
  end
186
186
 
@@ -3,7 +3,7 @@
3
3
  require "rack/utils"
4
4
 
5
5
  module Explicit::MCPServer
6
- Request = ::Data.define(:id, :method, :params, :host, :headers) do
6
+ Request = ::Data.define(:id, :method, :params, :host, :headers, :rack_env) do
7
7
  def self.from_rack_env(env)
8
8
  headers = env.each_with_object({}) do |(key, value), hash|
9
9
  if key.start_with?("HTTP_") && key != "HTTP_HOST"
@@ -19,7 +19,8 @@ module Explicit::MCPServer
19
19
  method: body["method"],
20
20
  params: body["params"],
21
21
  host: env["HTTP_HOST"],
22
- headers:
22
+ headers:,
23
+ rack_env: env
23
24
  )
24
25
  rescue ::JSON::ParserError
25
26
  new(
@@ -27,7 +28,8 @@ module Explicit::MCPServer
27
28
  method: nil,
28
29
  params: nil,
29
30
  host: env["HTTP_HOST"],
30
- headers: headers
31
+ headers:,
32
+ rack_env: env
31
33
  )
32
34
  end
33
35
 
@@ -53,8 +53,6 @@ class Explicit::MCPServer::Router
53
53
  return request.error({ code: -32602, message: "tool not found" })
54
54
  end
55
55
 
56
- session = ::ActionDispatch::Integration::Session.new(::Rails.application)
57
- session.host = request.host
58
56
  route = tool.request.routes.first
59
57
 
60
58
  path = [
@@ -62,23 +60,40 @@ class Explicit::MCPServer::Router
62
60
  route.replace_path_params(arguments)
63
61
  ].compact_blank.join
64
62
 
65
- path, params =
63
+ body_content, querystring =
66
64
  if route.accepts_request_body?
67
- [path, arguments]
65
+ [arguments.to_json, ""]
68
66
  else
69
- ["#{path}?#{arguments.to_query}", nil]
67
+ ["", arguments.to_query]
70
68
  end
71
69
 
72
- session.process(route.method, path, params:, headers: request.headers)
70
+ rack_input = ::StringIO.new(body_content)
71
+ rack_input.rewind
72
+
73
+ env = request.rack_env.merge({
74
+ "REQUEST_METHOD" => route.method.to_s.upcase,
75
+ "PATH_INFO" => path,
76
+ "rack.input" => rack_input,
77
+ "CONTENT_TYPE" => "application/json",
78
+ "CONTENT_LENGTH" => body_content.bytesize.to_s,
79
+ "QUERY_STRING" => querystring
80
+ })
81
+
82
+ request.headers.each do |key, value|
83
+ env["HTTP_#{key.upcase.tr('-', '_')}"] = value
84
+ end
85
+
86
+ status, headers, body = Rails.application.call(env)
87
+ response = ::ActionDispatch::Response.new(status, headers, body)
73
88
 
74
89
  request.result({
75
90
  content: [
76
91
  {
77
92
  type: "text",
78
- text: session.response.body
93
+ text: response.body
79
94
  }
80
95
  ],
81
- isError: session.response.status < 200 || session.response.status > 299
96
+ isError: response.status < 200 || response.status > 299
82
97
  })
83
98
  end
84
99
  end
@@ -6,9 +6,7 @@ module Explicit::MCPServer
6
6
  def new(&block)
7
7
  engine = ::Class.new(::Rails::Engine)
8
8
 
9
- builder = Builder.new.tap do |builder|
10
- builder.instance_eval(&block)
11
- end
9
+ builder = Builder.new.tap { _1.instance_eval(&block) }
12
10
 
13
11
  if builder.get_name.blank?
14
12
  raise <<~TEXT
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Explicit
4
- VERSION = "0.2.17"
4
+ VERSION = "0.2.19"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: explicit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.17
4
+ version: 0.2.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luiz Vasconcellos