rails-pg-extras-mcp 0.2.1 → 0.2.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 +4 -4
- data/lib/rails-pg-extras-mcp.rb +47 -0
- data/lib/rails_pg_extras_mcp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6544b81c0de61c0ac92c52514874ec1672990525739d3ae4fe989d2f8f88f4eb
|
4
|
+
data.tar.gz: d9c1d471162694594c59165864ba48a2cd7bfcf0741e1dca4bd9246b769ea138
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 950732591722d121efe13ee44003c6573dc5bbbedf7df3476c71324aa9b6dc9c26ff5c55fc4e7714ae4d34ae674d7e7f7f3cc48cdfc11ebf592145b56c601b6f
|
7
|
+
data.tar.gz: 9024824533e151b01dc9150f4daa850ac0b0cbbfb875ebf34bdce8a1a03d65c45125b6094f1cb61ab6cbf843cf537531e81a9db53b6d9f6137d16952ff1ff6c3
|
data/lib/rails-pg-extras-mcp.rb
CHANGED
@@ -126,6 +126,50 @@ class ExplainAnalyzeTool < ExplainBaseTool
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
+
class IndexInfoTool < FastMcp::Tool
|
130
|
+
description "Shows information about table indexes: name, table name, columns, index size, index scans, null frac"
|
131
|
+
|
132
|
+
arguments do
|
133
|
+
required(:table_name).filled(:string).description("The table name to get index info for")
|
134
|
+
end
|
135
|
+
|
136
|
+
def call(table_name:)
|
137
|
+
RailsPgExtras.index_info(args: { table_name: table_name }, in_format: :hash)
|
138
|
+
end
|
139
|
+
|
140
|
+
def self.name
|
141
|
+
"index_info"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
class TableInfoTool < FastMcp::Tool
|
146
|
+
description "Shows information about a table: name, size, cache hit, estimated rows, sequential scans, indexes scans"
|
147
|
+
|
148
|
+
arguments do
|
149
|
+
required(:table_name).filled(:string).description("The table name to get info for")
|
150
|
+
end
|
151
|
+
|
152
|
+
def call(table_name:)
|
153
|
+
RailsPgExtras.table_info(args: { table_name: table_name }, in_format: :hash)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
class TableSchemaTool < FastMcp::Tool
|
158
|
+
description "Shows the schema of a table"
|
159
|
+
|
160
|
+
arguments do
|
161
|
+
required(:table_name).filled(:string).description("The table name to get schema for")
|
162
|
+
end
|
163
|
+
|
164
|
+
def call(table_name:)
|
165
|
+
RailsPgExtras.table_schema(args: { table_name: table_name }, in_format: :hash)
|
166
|
+
end
|
167
|
+
|
168
|
+
def self.name
|
169
|
+
"table_schema"
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
129
173
|
class ReadmeResource < FastMcp::Resource
|
130
174
|
uri "https://raw.githubusercontent.com/pawurb/rails-pg-extras/refs/heads/main/README.md"
|
131
175
|
resource_name "README"
|
@@ -163,6 +207,9 @@ module RailsPgExtrasMcp
|
|
163
207
|
server.register_tools(DiagnoseTool)
|
164
208
|
server.register_tools(MissingFkConstraintsTool)
|
165
209
|
server.register_tools(MissingFkIndexesTool)
|
210
|
+
server.register_tools(IndexInfoTool)
|
211
|
+
server.register_tools(TableInfoTool)
|
212
|
+
server.register_tools(TableSchemaTool)
|
166
213
|
server.register_tools(*QUERY_TOOL_CLASSES)
|
167
214
|
server.register_tools(ExplainTool) if ENV["PG_EXTRAS_MCP_EXPLAIN_ENABLED"] == "true"
|
168
215
|
server.register_tools(ExplainAnalyzeTool) if ENV["PG_EXTRAS_MCP_EXPLAIN_ANALYZE_ENABLED"] == "true"
|