rails-pg-extras-mcp 0.2.2 → 0.2.3

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: 6544b81c0de61c0ac92c52514874ec1672990525739d3ae4fe989d2f8f88f4eb
4
- data.tar.gz: d9c1d471162694594c59165864ba48a2cd7bfcf0741e1dca4bd9246b769ea138
3
+ metadata.gz: 72d363ce5cf74c8c22e8a636c3b908f27be10cc5a21691acd480b791ab9e8c33
4
+ data.tar.gz: 36f3cb7fd5c1784c727def8ea7ad4c6f572f21c301ce99440440e4d5843f1e62
5
5
  SHA512:
6
- metadata.gz: 950732591722d121efe13ee44003c6573dc5bbbedf7df3476c71324aa9b6dc9c26ff5c55fc4e7714ae4d34ae674d7e7f7f3cc48cdfc11ebf592145b56c601b6f
7
- data.tar.gz: 9024824533e151b01dc9150f4daa850ac0b0cbbfb875ebf34bdce8a1a03d65c45125b6094f1cb61ab6cbf843cf537531e81a9db53b6d9f6137d16952ff1ff6c3
6
+ metadata.gz: 5565add5c44d77aa22c20f238c5f87d1f6e537f03f2b1d40fee5a5bbde03ed46690d11ecfecdecf791d65c0d748a26eaae5940d8808163e2c335fc4bad3c29ef
7
+ data.tar.gz: 8f7235f0b1e8ec213379c2f98895522ca54eed4c3c4912d7c5773a377fb9e0207a638ace52f235b7a6012161ed3f543afa565ecb5281e1f5fc3a7f09039f04b5
@@ -75,23 +75,18 @@ class ExplainBaseTool < FastMcp::Tool
75
75
  create,
76
76
  grant,
77
77
  begin,
78
- commit,
79
- ;
78
+ commit
80
79
  ]
81
80
 
82
- arguments do
83
- required(:query).filled(:string).description("The query to debug")
84
- end
85
-
86
- def call(query:)
81
+ def call(sql_query:)
87
82
  connection = RailsPgExtras.connection
88
83
 
89
- if DENYLIST.any? { |deny| query.downcase.include?(deny) }
84
+ if DENYLIST.any? { |deny| sql_query.downcase.include?(deny) }
90
85
  raise "This query is not allowed. It contains a denied keyword. Denylist: #{DENYLIST.join(", ")}"
91
86
  end
92
87
 
93
88
  connection.execute("BEGIN")
94
- result = connection.execute("#{query}")
89
+ result = connection.execute("#{sql_query}")
95
90
  connection.execute("ROLLBACK")
96
91
 
97
92
  result.to_a
@@ -101,28 +96,36 @@ end
101
96
  class ExplainTool < ExplainBaseTool
102
97
  description "EXPLAIN a query. It must be an SQL string, without the EXPLAIN prefix"
103
98
 
99
+ arguments do
100
+ required(:sql_query).filled(:string).description("The SQL query to debug")
101
+ end
102
+
104
103
  def self.name
105
104
  "explain"
106
105
  end
107
106
 
108
- def call(query:)
109
- if query.downcase.include?("analyze")
107
+ def call(sql_query:)
108
+ if sql_query.downcase.include?("analyze")
110
109
  raise "This query is not allowed. It contains a denied ANALYZE keyword."
111
110
  end
112
111
 
113
- super(query: "EXPLAIN #{query}")
112
+ super(sql_query: "EXPLAIN #{sql_query}")
114
113
  end
115
114
  end
116
115
 
117
116
  class ExplainAnalyzeTool < ExplainBaseTool
118
117
  description "EXPLAIN ANALYZE a query. It must be an SQL string, without the EXPLAIN ANALYZE prefix"
119
118
 
119
+ arguments do
120
+ required(:sql_query).filled(:string).description("The SQL query to debug")
121
+ end
122
+
120
123
  def self.name
121
124
  "explain_analyze"
122
125
  end
123
126
 
124
- def call(query:)
125
- super(query: "EXPLAIN ANALYZE #{query}")
127
+ def call(sql_query:)
128
+ super(sql_query: "EXPLAIN ANALYZE #{sql_query}")
126
129
  end
127
130
  end
128
131
 
@@ -152,6 +155,10 @@ class TableInfoTool < FastMcp::Tool
152
155
  def call(table_name:)
153
156
  RailsPgExtras.table_info(args: { table_name: table_name }, in_format: :hash)
154
157
  end
158
+
159
+ def self.name
160
+ "table_info"
161
+ end
155
162
  end
156
163
 
157
164
  class TableSchemaTool < FastMcp::Tool
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsPgExtrasMcp
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-pg-extras-mcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb