mcp-trino-python 0.3.0__tar.gz → 0.5.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-trino-python
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: A Model Context Protocol (MCP) connector for Trino, enabling seamless integration between MCP-compliant services and Trino query engine
5
5
  License: Apache-2.0
6
6
  Keywords: trino,connector,mcp
@@ -21,6 +21,7 @@ Dynamic: license-file
21
21
 
22
22
  # MCP Trino Server
23
23
 
24
+ [![smithery badge](https://smithery.ai/badge/@alaturqua/mcp-trino-python)](https://smithery.ai/server/@alaturqua/mcp-trino-python)
24
25
  [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
25
26
  [![VS Code](https://img.shields.io/badge/vscode-available-007ACC.svg?style=flat-square&logo=visual-studio-code&logoColor=white)](https://code.visualstudio.com/)
26
27
  [![Docker](https://img.shields.io/badge/docker-available-2496ED.svg?style=flat-square&logo=docker&logoColor=white)](https://github.com/alaturqua/mcp-trino-python/pkgs/container/mcp-trino-python)
@@ -45,6 +46,14 @@ data exploration, querying, and table maintenance capabilities through a standar
45
46
 
46
47
  ## Installation
47
48
 
49
+ ### Installing via Smithery
50
+
51
+ To install MCP Trino Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@alaturqua/mcp-trino-python):
52
+
53
+ ```bash
54
+ npx -y @smithery/cli install @alaturqua/mcp-trino-python --client claude
55
+ ```
56
+
48
57
  ### Running Trino Locally
49
58
 
50
59
  The easiest way to get started is to use the included Docker Compose configuration to run Trino locally:
@@ -119,32 +128,35 @@ Add the following configuration to your Claude Desktop settings:
119
128
  | TRINO_HTTP_SCHEME | HTTP scheme (http/https) | http |
120
129
  | TRINO_PASSWORD | Trino password | None |
121
130
 
122
- ## Resources
123
-
124
- The server provides the following MCP resources:
131
+ ## Tools
125
132
 
126
- ### Catalog and Schema Navigation
133
+ ### Query and Exploration Tools
127
134
 
128
- - **catalog://main** (`show_catalogs`)
135
+ - **show_catalogs**
129
136
 
130
- - Lists all available Trino catalogs
137
+ - List all available catalogs
131
138
  - No parameters required
132
139
 
133
- - **schema://{catalog}** (`show_schemas`)
140
+ - **show_schemas**
134
141
 
135
- - Lists all schemas in the specified catalog
142
+ - List all schemas in a catalog
136
143
  - Parameters:
137
144
  - `catalog`: Catalog name (string, required)
138
145
 
139
- - **table://{catalog}/{schema}** (`show_tables`)
140
- - Lists all tables in the specified schema
146
+ - **show_tables**
147
+
148
+ - List all tables in a schema
141
149
  - Parameters:
142
150
  - `catalog`: Catalog name (string, required)
143
151
  - `schema`: Schema name (string, required)
144
152
 
145
- ## Tools
153
+ - **describe_table**
146
154
 
147
- ### Query and Exploration Tools
155
+ - Show detailed table structure and column information
156
+ - Parameters:
157
+ - `table`: Table name (string, required)
158
+ - `catalog`: Catalog name (string, optional)
159
+ - `schema`: Schema name (string, optional)
148
160
 
149
161
  - **execute_query**
150
162
 
@@ -1,5 +1,6 @@
1
1
  # MCP Trino Server
2
2
 
3
+ [![smithery badge](https://smithery.ai/badge/@alaturqua/mcp-trino-python)](https://smithery.ai/server/@alaturqua/mcp-trino-python)
3
4
  [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
4
5
  [![VS Code](https://img.shields.io/badge/vscode-available-007ACC.svg?style=flat-square&logo=visual-studio-code&logoColor=white)](https://code.visualstudio.com/)
5
6
  [![Docker](https://img.shields.io/badge/docker-available-2496ED.svg?style=flat-square&logo=docker&logoColor=white)](https://github.com/alaturqua/mcp-trino-python/pkgs/container/mcp-trino-python)
@@ -24,6 +25,14 @@ data exploration, querying, and table maintenance capabilities through a standar
24
25
 
25
26
  ## Installation
26
27
 
28
+ ### Installing via Smithery
29
+
30
+ To install MCP Trino Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@alaturqua/mcp-trino-python):
31
+
32
+ ```bash
33
+ npx -y @smithery/cli install @alaturqua/mcp-trino-python --client claude
34
+ ```
35
+
27
36
  ### Running Trino Locally
28
37
 
29
38
  The easiest way to get started is to use the included Docker Compose configuration to run Trino locally:
@@ -98,32 +107,35 @@ Add the following configuration to your Claude Desktop settings:
98
107
  | TRINO_HTTP_SCHEME | HTTP scheme (http/https) | http |
99
108
  | TRINO_PASSWORD | Trino password | None |
100
109
 
101
- ## Resources
102
-
103
- The server provides the following MCP resources:
110
+ ## Tools
104
111
 
105
- ### Catalog and Schema Navigation
112
+ ### Query and Exploration Tools
106
113
 
107
- - **catalog://main** (`show_catalogs`)
114
+ - **show_catalogs**
108
115
 
109
- - Lists all available Trino catalogs
116
+ - List all available catalogs
110
117
  - No parameters required
111
118
 
112
- - **schema://{catalog}** (`show_schemas`)
119
+ - **show_schemas**
113
120
 
114
- - Lists all schemas in the specified catalog
121
+ - List all schemas in a catalog
115
122
  - Parameters:
116
123
  - `catalog`: Catalog name (string, required)
117
124
 
118
- - **table://{catalog}/{schema}** (`show_tables`)
119
- - Lists all tables in the specified schema
125
+ - **show_tables**
126
+
127
+ - List all tables in a schema
120
128
  - Parameters:
121
129
  - `catalog`: Catalog name (string, required)
122
130
  - `schema`: Schema name (string, required)
123
131
 
124
- ## Tools
132
+ - **describe_table**
125
133
 
126
- ### Query and Exploration Tools
134
+ - Show detailed table structure and column information
135
+ - Parameters:
136
+ - `table`: Table name (string, required)
137
+ - `catalog`: Catalog name (string, optional)
138
+ - `schema`: Schema name (string, optional)
127
139
 
128
140
  - **execute_query**
129
141
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mcp-trino-python"
3
- version = "0.3.0"
3
+ version = "0.5.0"
4
4
  description = "A Model Context Protocol (MCP) connector for Trino, enabling seamless integration between MCP-compliant services and Trino query engine"
5
5
  readme = "README.md"
6
6
  license = { text = "Apache-2.0" }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-trino-python
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: A Model Context Protocol (MCP) connector for Trino, enabling seamless integration between MCP-compliant services and Trino query engine
5
5
  License: Apache-2.0
6
6
  Keywords: trino,connector,mcp
@@ -21,6 +21,7 @@ Dynamic: license-file
21
21
 
22
22
  # MCP Trino Server
23
23
 
24
+ [![smithery badge](https://smithery.ai/badge/@alaturqua/mcp-trino-python)](https://smithery.ai/server/@alaturqua/mcp-trino-python)
24
25
  [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
25
26
  [![VS Code](https://img.shields.io/badge/vscode-available-007ACC.svg?style=flat-square&logo=visual-studio-code&logoColor=white)](https://code.visualstudio.com/)
26
27
  [![Docker](https://img.shields.io/badge/docker-available-2496ED.svg?style=flat-square&logo=docker&logoColor=white)](https://github.com/alaturqua/mcp-trino-python/pkgs/container/mcp-trino-python)
@@ -45,6 +46,14 @@ data exploration, querying, and table maintenance capabilities through a standar
45
46
 
46
47
  ## Installation
47
48
 
49
+ ### Installing via Smithery
50
+
51
+ To install MCP Trino Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@alaturqua/mcp-trino-python):
52
+
53
+ ```bash
54
+ npx -y @smithery/cli install @alaturqua/mcp-trino-python --client claude
55
+ ```
56
+
48
57
  ### Running Trino Locally
49
58
 
50
59
  The easiest way to get started is to use the included Docker Compose configuration to run Trino locally:
@@ -119,32 +128,35 @@ Add the following configuration to your Claude Desktop settings:
119
128
  | TRINO_HTTP_SCHEME | HTTP scheme (http/https) | http |
120
129
  | TRINO_PASSWORD | Trino password | None |
121
130
 
122
- ## Resources
123
-
124
- The server provides the following MCP resources:
131
+ ## Tools
125
132
 
126
- ### Catalog and Schema Navigation
133
+ ### Query and Exploration Tools
127
134
 
128
- - **catalog://main** (`show_catalogs`)
135
+ - **show_catalogs**
129
136
 
130
- - Lists all available Trino catalogs
137
+ - List all available catalogs
131
138
  - No parameters required
132
139
 
133
- - **schema://{catalog}** (`show_schemas`)
140
+ - **show_schemas**
134
141
 
135
- - Lists all schemas in the specified catalog
142
+ - List all schemas in a catalog
136
143
  - Parameters:
137
144
  - `catalog`: Catalog name (string, required)
138
145
 
139
- - **table://{catalog}/{schema}** (`show_tables`)
140
- - Lists all tables in the specified schema
146
+ - **show_tables**
147
+
148
+ - List all tables in a schema
141
149
  - Parameters:
142
150
  - `catalog`: Catalog name (string, required)
143
151
  - `schema`: Schema name (string, required)
144
152
 
145
- ## Tools
153
+ - **describe_table**
146
154
 
147
- ### Query and Exploration Tools
155
+ - Show detailed table structure and column information
156
+ - Parameters:
157
+ - `table`: Table name (string, required)
158
+ - `catalog`: Catalog name (string, optional)
159
+ - `schema`: Schema name (string, optional)
148
160
 
149
161
  - **execute_query**
150
162
 
@@ -6,6 +6,7 @@ functionality through resources and tools, with special support for Iceberg tabl
6
6
 
7
7
  from mcp.server.fastmcp import FastMCP
8
8
  from mcp.server.fastmcp.prompts import base
9
+ from pydantic import Field
9
10
 
10
11
  from config import load_config
11
12
  from trino_client import TrinoClient
@@ -13,73 +14,112 @@ from trino_client import TrinoClient
13
14
  # Initialize the MCP server and Trino client
14
15
  config = load_config()
15
16
  client = TrinoClient(config)
16
- mcp = FastMCP("Trino Explorer", dependencies=["trino", "python-dotenv", "loguru"])
17
17
 
18
18
 
19
- # Resources
20
- @mcp.resource(
21
- "catalog://main",
22
- name="show_catalogs",
23
- description="List all available Trino catalogs",
19
+ # Initialize the MCP server with context
20
+ mcp = FastMCP(
21
+ name="Trino Explorer",
22
+ instructions="This Model Context Protocol (MCP) server provides access to Trino Query Engine.",
23
+ dependencies=["trino", "python-dotenv", "loguru"],
24
24
  )
25
+
26
+
27
+ # Tools
28
+ @mcp.tool(description="List all available catalogs")
25
29
  def show_catalogs() -> str:
26
- """List all available Trino catalogs."""
27
- return client.show_catalogs()
30
+ """List all available catalogs."""
31
+ return client.list_catalogs()
28
32
 
29
33
 
30
- @mcp.resource(
31
- "schema://{catalog}",
32
- name="show_schemas",
33
- description="List all schemas in the specified catalog",
34
- )
35
- def show_schemas(catalog: str) -> str:
36
- """List all schemas in a catalog."""
37
- return client.show_schemas(catalog)
34
+ @mcp.tool(description="List all schemas in a catalog")
35
+ def show_schemas(catalog: str = Field(description="The name of the catalog")) -> str:
36
+ """List all schemas in a catalog.
38
37
 
38
+ Args:
39
+ catalog: The name of the catalog
39
40
 
40
- @mcp.resource(
41
- "table://{catalog}/{schema}",
42
- name="show_tables",
43
- description="List all tables in the specified schema",
44
- )
45
- def show_tables(catalog: str, schema: str) -> str:
46
- """List all tables in a schema."""
47
- return client.show_tables(catalog, schema)
41
+ Returns:
42
+ str: List of schemas in the specified catalog
43
+ """
44
+ return client.list_schemas(catalog)
45
+
46
+
47
+ @mcp.tool(description="List all tables in a schema")
48
+ def show_tables(
49
+ catalog: str = Field(description="The name of the catalog"),
50
+ schema_name: str = Field(description="The name of the schema"),
51
+ ) -> str:
52
+ """List all tables in a schema.
53
+
54
+ Args:
55
+ catalog: The name of the catalog
56
+ schema_name: The name of the schema
57
+
58
+ Returns:
59
+ str: List of tables in the specified schema
60
+ """
61
+ return client.list_tables(catalog, schema_name)
62
+
63
+
64
+ @mcp.tool(description="Describe a table")
65
+ def describe_table(
66
+ catalog: str = Field(description="The catalog name"),
67
+ schema_name: str = Field(description="The schema name"),
68
+ table: str = Field(description="The name of the table"),
69
+ ) -> str:
70
+ """Describe a table.
71
+
72
+ Args:
73
+ catalog (str): The catalog name
74
+ schema_name (str): The schema name
75
+ table (str): The name of the table
76
+
77
+ Returns:
78
+ str: Table description in JSON format
79
+ """
80
+ return client.describe_table(catalog, schema_name, table)
48
81
 
49
82
 
50
- # Tools
51
83
  @mcp.tool(description="Show the CREATE TABLE statement for a specific table")
52
- def show_create_table(table: str, catalog: str | None = None, schema: str | None = None) -> str:
84
+ def show_create_table(
85
+ catalog: str = Field(description="catalog name "),
86
+ schema_name: str = Field(description="schema name "),
87
+ table: str = Field(description="The name of the table"),
88
+ ) -> str:
53
89
  """Show the CREATE TABLE statement for a table.
54
90
 
55
91
  Args:
92
+ catalog: catalog name
93
+ schema_name: schema name
56
94
  table: The name of the table
57
- catalog: Optional catalog name (defaults to configured catalog)
58
- schema: Optional schema name (defaults to configured schema)
59
95
 
60
96
  Returns:
61
97
  str: The CREATE TABLE statement
62
98
  """
63
- return client.show_create_table(table, catalog, schema)
99
+ return client.show_create_table(catalog, schema_name, table)
64
100
 
65
101
 
66
102
  @mcp.tool(description="Show the CREATE VIEW statement for a specific view")
67
- def show_create_view(view: str, catalog: str | None = None, schema: str | None = None) -> str:
103
+ def show_create_view(
104
+ catalog: str = Field(description="catalog name "),
105
+ schema_name: str = Field(description="schema name "),
106
+ view: str = Field(description="The name of the view"),
107
+ ) -> str:
68
108
  """Show the CREATE VIEW statement for a view.
69
109
 
70
110
  Args:
111
+ catalog: catalog name
112
+ schema_name: schema name
71
113
  view: The name of the view
72
- catalog: Optional catalog name (defaults to configured catalog)
73
- schema: Optional schema name (defaults to configured schema)
74
114
 
75
115
  Returns:
76
116
  str: The CREATE VIEW statement
77
117
  """
78
- return client.show_create_view(view, catalog, schema)
118
+ return client.show_create_view(catalog, schema_name, view)
79
119
 
80
120
 
81
121
  @mcp.tool(description="Execute a SQL query and return results in a readable format")
82
- def execute_query(query: str) -> str:
122
+ def execute_query(query: str = Field(description="The SQL query to execute")) -> str:
83
123
  """Execute a SQL query and return formatted results.
84
124
 
85
125
  Args:
@@ -92,77 +132,93 @@ def execute_query(query: str) -> str:
92
132
 
93
133
 
94
134
  @mcp.tool(description="Optimize an Iceberg table's data files")
95
- def optimize(table: str, catalog: str | None = None, schema: str | None = None) -> str:
135
+ def optimize(
136
+ catalog: str = Field(description="catalog name "),
137
+ schema_name: str = Field(description="schema name "),
138
+ table: str = Field(description="The name of the table to optimize"),
139
+ ) -> str:
96
140
  """Optimize an Iceberg table by compacting small files.
97
141
 
98
142
  Args:
143
+ catalog: catalog name
144
+ schema_name: schema name
99
145
  table: The name of the table to optimize
100
- catalog: Optional catalog name (defaults to configured catalog)
101
- schema: Optional schema name (defaults to configured schema)
102
146
 
103
147
  Returns:
104
148
  str: Confirmation message
105
149
  """
106
- return client.optimize(table, catalog, schema)
150
+ return client.optimize(catalog, schema_name, table)
107
151
 
108
152
 
109
153
  @mcp.tool(description="Optimize manifest files for an Iceberg table")
110
- def optimize_manifests(table: str, catalog: str | None = None, schema: str | None = None) -> str:
154
+ def optimize_manifests(
155
+ catalog: str = Field(description="catalog name "),
156
+ schema_name: str = Field(description="schema name "),
157
+ table: str = Field(description="The name of the table"),
158
+ ) -> str:
111
159
  """Optimize manifest files for an Iceberg table.
112
160
 
113
161
  Args:
162
+ catalog: catalog name
163
+ schema_name: schema name
114
164
  table: The name of the table
115
- catalog: Optional catalog name (defaults to configured catalog)
116
- schema: Optional schema name (defaults to configured schema)
117
165
 
118
166
  Returns:
119
167
  str: Confirmation message
120
168
  """
121
- return client.optimize_manifests(table, catalog, schema)
169
+ return client.optimize_manifests(catalog, schema_name, table)
122
170
 
123
171
 
124
172
  @mcp.tool(description="Remove old snapshots from an Iceberg table")
125
173
  def expire_snapshots(
126
- table: str,
127
- retention_threshold: str = "7d",
128
- catalog: str | None = None,
129
- schema: str | None = None,
174
+ catalog: str = Field(description="catalog name "),
175
+ schema_name: str = Field(description="schema name "),
176
+ retention_threshold: str = Field(
177
+ description="Age threshold for snapshot removal (e.g., '7d', '30d')", default="7d"
178
+ ),
179
+ table: str = Field(description="The name of the table"),
130
180
  ) -> str:
131
181
  """Remove old snapshots from an Iceberg table.
132
182
 
133
183
  Args:
184
+ catalog: catalog name
185
+ schema_name: schema name
134
186
  table: The name of the table
135
187
  retention_threshold: Age threshold for snapshot removal (e.g., "7d", "30d")
136
- catalog: Optional catalog name (defaults to configured catalog)
137
- schema: Optional schema name (defaults to configured schema)
138
188
 
139
189
  Returns:
140
190
  str: Confirmation message
141
191
  """
142
- return client.expire_snapshots(table, retention_threshold, catalog, schema)
192
+ return client.expire_snapshots(catalog, schema_name, table, retention_threshold)
143
193
 
144
194
 
145
195
  @mcp.tool(description="Show statistics for a table")
146
- def show_stats(table: str, catalog: str | None = None, schema: str | None = None) -> str:
196
+ def show_stats(
197
+ catalog: str = Field(description="catalog name "),
198
+ schema_name: str = Field(description="schema name "),
199
+ table: str = Field(description="The name of the table"),
200
+ ) -> str:
147
201
  """Show statistics for a table.
148
202
 
149
203
  Args:
204
+ catalog: catalog name
205
+ schema_name: schema name
150
206
  table: The name of the table
151
- catalog: Optional catalog name (defaults to configured catalog)
152
- schema: Optional schema name (defaults to configured schema)
153
207
 
154
208
  Returns:
155
209
  str: Table statistics in JSON format
156
210
  """
157
- return client.show_stats(table, catalog, schema)
211
+ return client.show_stats(catalog, schema_name, table)
158
212
 
159
213
 
160
214
  @mcp.tool(name="show_query_history", description="Get the history of executed queries")
161
- def show_query_history(limit: int | None = None) -> str:
215
+ def show_query_history(
216
+ limit: int = Field(description="maximum number of history entries to return", default=None),
217
+ ) -> str:
162
218
  """Get the history of executed queries.
163
219
 
164
220
  Args:
165
- limit: Optional maximum number of history entries to return.
221
+ limit: maximum number of history entries to return.
166
222
  If None, returns all entries.
167
223
 
168
224
  Returns:
@@ -182,22 +238,30 @@ def show_catalog_tree() -> str:
182
238
 
183
239
 
184
240
  @mcp.tool(description="Show Iceberg table properties")
185
- def show_table_properties(table: str, catalog: str | None = None, schema: str | None = None) -> str:
241
+ def show_table_properties(
242
+ catalog: str = Field(description="catalog name "),
243
+ schema_name: str = Field(description="schema name "),
244
+ table: str = Field(description="The name of the table"),
245
+ ) -> str:
186
246
  """Show Iceberg table properties.
187
247
 
188
248
  Args:
249
+ catalog: catalog name
250
+ schema_name: schema name
189
251
  table: The name of the table
190
- catalog: Optional catalog name (defaults to configured catalog)
191
- schema: Optional schema name (defaults to configured schema)
192
252
 
193
253
  Returns:
194
254
  str: JSON-formatted table properties
195
255
  """
196
- return client.show_table_properties(table, catalog, schema)
256
+ return client.show_table_properties(catalog, schema_name, table)
197
257
 
198
258
 
199
259
  @mcp.tool(description="Show Iceberg table history/changelog")
200
- def show_table_history(table: str, catalog: str | None = None, schema: str | None = None) -> str:
260
+ def show_table_history(
261
+ catalog: str = Field(description="catalog name "),
262
+ schema_name: str = Field(description="schema name "),
263
+ table: str = Field(description="The name of the table"),
264
+ ) -> str:
201
265
  """Show Iceberg table history/changelog.
202
266
 
203
267
  The history contains:
@@ -207,18 +271,22 @@ def show_table_history(table: str, catalog: str | None = None, schema: str | Non
207
271
  - is_current_ancestor: Whether snapshot is an ancestor of current
208
272
 
209
273
  Args:
274
+ catalog: catalog name
275
+ schema_name: schema name
210
276
  table: The name of the table
211
- catalog: Optional catalog name (defaults to configured catalog)
212
- schema: Optional schema name (defaults to configured schema)
213
277
 
214
278
  Returns:
215
279
  str: JSON-formatted table history
216
280
  """
217
- return client.show_table_history(table, catalog, schema)
281
+ return client.show_table_history(catalog, schema_name, table)
218
282
 
219
283
 
220
- @mcp.tool(description="Show Iceberg table metadata log entries")
221
- def show_metadata_log_entries(table: str, catalog: str | None = None, schema: str | None = None) -> str:
284
+ @mcp.tool(description="Show metadata for the table")
285
+ def show_metadata_log_entries(
286
+ catalog: str = Field(description="catalog name "),
287
+ schema_name: str = Field(description="schema name "),
288
+ table: str = Field(description="The name of the table"),
289
+ ) -> str:
222
290
  """Show Iceberg table metadata log entries.
223
291
 
224
292
  The metadata log contains:
@@ -229,18 +297,22 @@ def show_metadata_log_entries(table: str, catalog: str | None = None, schema: st
229
297
  - latest_sequence_number: Data sequence number of metadata file
230
298
 
231
299
  Args:
300
+ catalog: catalog name
301
+ schema_name: schema name
232
302
  table: The name of the table
233
- catalog: Optional catalog name (defaults to configured catalog)
234
- schema: Optional schema name (defaults to configured schema)
235
303
 
236
304
  Returns:
237
305
  str: JSON-formatted metadata log entries
238
306
  """
239
- return client.show_metadata_log_entries(table, catalog, schema)
307
+ return client.show_metadata_log_entries(catalog, schema_name, table)
240
308
 
241
309
 
242
310
  @mcp.tool(description="Show Iceberg table snapshots")
243
- def show_snapshots(table: str, catalog: str | None = None, schema: str | None = None) -> str:
311
+ def show_snapshots(
312
+ catalog: str = Field(description="catalog name "),
313
+ schema_name: str = Field(description="schema name "),
314
+ table: str = Field(description="The name of the table"),
315
+ ) -> str:
244
316
  """Show Iceberg table snapshots.
245
317
 
246
318
  The snapshots table contains:
@@ -252,19 +324,22 @@ def show_snapshots(table: str, catalog: str | None = None, schema: str | None =
252
324
  - summary: Summary of changes from previous snapshot
253
325
 
254
326
  Args:
327
+ catalog: catalog name
328
+ schema_name: schema name
255
329
  table: The name of the table
256
- catalog: Optional catalog name (defaults to configured catalog)
257
- schema: Optional schema name (defaults to configured schema)
258
330
 
259
331
  Returns:
260
332
  str: JSON-formatted table snapshots
261
333
  """
262
- return client.show_snapshots(table, catalog, schema)
334
+ return client.show_snapshots(catalog, schema_name, table)
263
335
 
264
336
 
265
337
  @mcp.tool(description="Show Iceberg table manifests")
266
338
  def show_manifests(
267
- table: str, catalog: str | None = None, schema: str | None = None, all_snapshots: bool = False
339
+ catalog: str = Field(description="catalog name"),
340
+ schema_name: str = Field(description="schema name"),
341
+ table: str = Field(description="The name of the table"),
342
+ all_snapshots: bool = False,
268
343
  ) -> str:
269
344
  """Show Iceberg table manifests for current or all snapshots.
270
345
 
@@ -282,19 +357,23 @@ def show_manifests(
282
357
  - partition_summaries: Partition range metadata
283
358
 
284
359
  Args:
360
+ catalog: catalog name
361
+ schema_name: schema name
285
362
  table: The name of the table
286
- catalog: Optional catalog name (defaults to configured catalog)
287
- schema: Optional schema name (defaults to configured schema)
288
363
  all_snapshots: If True, show manifests from all snapshots
289
364
 
290
365
  Returns:
291
366
  str: JSON-formatted table manifests
292
367
  """
293
- return client.show_manifests(table, catalog, schema, all_snapshots)
368
+ return client.show_manifests(catalog, schema_name, table, all_snapshots)
294
369
 
295
370
 
296
371
  @mcp.tool(description="Show Iceberg table partitions")
297
- def show_partitions(table: str, catalog: str | None = None, schema: str | None = None) -> str:
372
+ def show_partitions(
373
+ catalog: str = Field(description="catalog name "),
374
+ schema_name: str = Field(description="schema name "),
375
+ table: str = Field(description="The name of the table"),
376
+ ) -> str:
298
377
  """Show Iceberg table partitions.
299
378
 
300
379
  The partitions table contains:
@@ -305,18 +384,22 @@ def show_partitions(table: str, catalog: str | None = None, schema: str | None =
305
384
  - data: Partition range metadata with min/max values and null/nan counts
306
385
 
307
386
  Args:
387
+ catalog: catalog name
388
+ schema_name: schema name
308
389
  table: The name of the table
309
- catalog: Optional catalog name (defaults to configured catalog)
310
- schema: Optional schema name (defaults to configured schema)
311
390
 
312
391
  Returns:
313
392
  str: JSON-formatted table partitions
314
393
  """
315
- return client.show_partitions(table, catalog, schema)
394
+ return client.show_partitions(catalog, schema_name, table)
316
395
 
317
396
 
318
397
  @mcp.tool(description="Show Iceberg table data files")
319
- def show_files(table: str, catalog: str | None = None, schema: str | None = None) -> str:
398
+ def show_files(
399
+ catalog: str = Field(description="catalog name "),
400
+ schema_name: str = Field(description="schema name "),
401
+ table: str = Field(description="The name of the table"),
402
+ ) -> str:
320
403
  """Show Iceberg table data files in current snapshot.
321
404
 
322
405
  The files table contains:
@@ -336,18 +419,23 @@ def show_files(table: str, catalog: str | None = None, schema: str | None = None
336
419
  - equality_ids: Field IDs for equality deletes
337
420
 
338
421
  Args:
422
+ catalog: catalog name
423
+ schema_name: schema name
339
424
  table: The name of the table
340
- catalog: Optional catalog name (defaults to configured catalog)
341
- schema: Optional schema name (defaults to configured schema)
342
425
 
343
426
  Returns:
344
427
  str: JSON-formatted table files info
345
428
  """
346
- return client.show_files(table, catalog, schema)
429
+ return client.show_files(catalog, schema_name, table)
347
430
 
348
431
 
349
432
  @mcp.tool(description="Show Iceberg table manifest entries")
350
- def show_entries(table: str, catalog: str | None = None, schema: str | None = None, all_snapshots: bool = False) -> str:
433
+ def show_entries(
434
+ catalog: str = Field(description="catalog name "),
435
+ schema_name: str = Field(description="schema name "),
436
+ table: str = Field(description="The name of the table"),
437
+ all_snapshots: bool = False,
438
+ ) -> str:
351
439
  """Show Iceberg table manifest entries for current or all snapshots.
352
440
 
353
441
  The entries table contains:
@@ -359,19 +447,23 @@ def show_entries(table: str, catalog: str | None = None, schema: str | None = No
359
447
  - readable_metrics: Human-readable file metrics
360
448
 
361
449
  Args:
450
+ catalog: catalog name
451
+ schema_name: schema name
362
452
  table: The name of the table
363
- catalog: Optional catalog name (defaults to configured catalog)
364
- schema: Optional schema name (defaults to configured schema)
365
453
  all_snapshots: If True, show entries from all snapshots
366
454
 
367
455
  Returns:
368
456
  str: JSON-formatted manifest entries
369
457
  """
370
- return client.show_entries(table, catalog, schema, all_snapshots)
458
+ return client.show_entries(catalog, schema_name, table, all_snapshots)
371
459
 
372
460
 
373
461
  @mcp.tool(description="Show Iceberg table references (branches and tags)")
374
- def show_refs(table: str, catalog: str | None = None, schema: str | None = None) -> str:
462
+ def show_refs(
463
+ catalog: str = Field(description="catalog name "),
464
+ schema_name: str = Field(description="schema name "),
465
+ table: str = Field(description="The name of the table"),
466
+ ) -> str:
375
467
  """Show Iceberg table references (branches and tags).
376
468
 
377
469
  The refs table contains:
@@ -383,20 +475,28 @@ def show_refs(table: str, catalog: str | None = None, schema: str | None = None)
383
475
  - max_snapshot_age_in_ms: Max snapshot age in branch
384
476
 
385
477
  Args:
478
+ catalog: catalog name
479
+ schema_name: schema name
386
480
  table: The name of the table
387
- catalog: Optional catalog name (defaults to configured catalog)
388
- schema: Optional schema name (defaults to configured schema)
389
481
 
390
482
  Returns:
391
483
  str: JSON-formatted table references
392
484
  """
393
- return client.show_refs(table, catalog, schema)
485
+ return client.show_refs(catalog, schema_name, table)
394
486
 
395
487
 
396
488
  # Prompts
397
489
  @mcp.prompt()
398
- def explore_data(catalog: str | None = None, schema: str | None = None) -> list[base.Message]:
399
- """Interactive prompt to explore Trino data."""
490
+ def explore_data(catalog: str, schema_name: str) -> list[base.Message]:
491
+ """Interactive prompt to explore Trino data.
492
+
493
+ Args:
494
+ catalog: The name of the catalog to explore
495
+ schema_name: The name of the schema to explore
496
+
497
+ Returns:
498
+ list[base.Message]: A list of system and user messages to guide the conversation
499
+ """
400
500
  messages = [
401
501
  base.SystemMessage(
402
502
  "I'll help you explore data in Trino. I can show you available catalogs, "
@@ -404,10 +504,10 @@ def explore_data(catalog: str | None = None, schema: str | None = None) -> list[
404
504
  )
405
505
  ]
406
506
 
407
- if catalog and schema:
507
+ if catalog and schema_name:
408
508
  messages.append(
409
509
  base.UserMessage(
410
- f"Show me what tables are available in the {catalog}.{schema} schema and help me query them."
510
+ f"Show me what tables are available in the {catalog}.{schema_name} schema and help me query them."
411
511
  )
412
512
  )
413
513
  elif catalog:
@@ -419,7 +519,7 @@ def explore_data(catalog: str | None = None, schema: str | None = None) -> list[
419
519
 
420
520
 
421
521
  @mcp.prompt()
422
- def maintain_iceberg(table: str, catalog: str | None = None, schema: str | None = None) -> list[base.Message]:
522
+ def maintain_iceberg(table: str, catalog: str, schema_name: str) -> list[base.Message]:
423
523
  """Interactive prompt for Iceberg table maintenance."""
424
524
  return [
425
525
  base.SystemMessage(
@@ -428,7 +528,7 @@ def maintain_iceberg(table: str, catalog: str | None = None, schema: str | None
428
528
  ),
429
529
  base.UserMessage(
430
530
  f"What maintenance operations should we perform on the Iceberg table "
431
- f"{catalog + '.' if catalog else ''}{schema + '.' if schema else ''}{table}?"
531
+ f"{catalog + '.' if catalog else ''}{schema_name + '.' if schema_name else ''}{table}?"
432
532
  ),
433
533
  ]
434
534
 
@@ -437,4 +537,4 @@ if __name__ == "__main__":
437
537
  from loguru import logger
438
538
 
439
539
  logger.info("Starting Trino MCP server...")
440
- mcp.run()
540
+ mcp.run(transport="stdio")
@@ -69,11 +69,12 @@ class TrinoClient:
69
69
 
70
70
  Args:
71
71
  query (str): The SQL query to execute.
72
+ params (Optional[dict]): Dictionary of query parameters with primitive types.
72
73
 
73
74
  Returns:
74
75
  str: JSON-formatted string containing query results or success message.
75
76
  """
76
- cur = self.client.cursor()
77
+ cur: trino.dbapi.Cursor = self.client.cursor()
77
78
  cur.execute(query)
78
79
  if cur.description:
79
80
  return json.dumps(
@@ -82,7 +83,7 @@ class TrinoClient:
82
83
  )
83
84
  return "Query executed successfully (no results to display)"
84
85
 
85
- def get_query_history(self, limit: int | None = None) -> str:
86
+ def get_query_history(self, limit: int) -> str:
86
87
  """Retrieve the history of executed queries.
87
88
 
88
89
  Args:
@@ -96,7 +97,7 @@ class TrinoClient:
96
97
  query += f" LIMIT {limit}"
97
98
  return self.execute_query(query)
98
99
 
99
- def show_catalogs(self) -> str:
100
+ def list_catalogs(self) -> str:
100
101
  """List all available catalogs.
101
102
 
102
103
  Returns:
@@ -105,7 +106,7 @@ class TrinoClient:
105
106
  catalogs = [row["Catalog"] for row in json.loads(self.execute_query("SHOW CATALOGS"))]
106
107
  return "\n".join(catalogs)
107
108
 
108
- def show_schemas(self, catalog: str | None = None) -> str:
109
+ def list_schemas(self, catalog: str) -> str:
109
110
  """List all schemas in a catalog.
110
111
 
111
112
  Args:
@@ -125,7 +126,7 @@ class TrinoClient:
125
126
  schemas = [row["Schema"] for row in json.loads(self.execute_query(query))]
126
127
  return "\n".join(schemas)
127
128
 
128
- def show_tables(self, catalog: str | None = None, schema: str | None = None) -> str:
129
+ def list_tables(self, catalog: str, schema: str) -> str:
129
130
  """List all tables in a schema.
130
131
 
131
132
  Args:
@@ -147,13 +148,34 @@ class TrinoClient:
147
148
  tables = [row["Table"] for row in json.loads(self.execute_query(query))]
148
149
  return "\n".join(tables)
149
150
 
150
- def show_create_table(self, table: str, catalog: str | None = None, schema: str | None = None) -> str:
151
+ def describe_table(self, catalog: str, schema: str, table: str) -> str:
152
+ """Describe the structure of a table.
153
+
154
+ Args:
155
+ catalog (str): The catalog name. If None, uses configured default.
156
+ schema (str): The schema name. If None, uses configured default.
157
+ table (str): The name of the table.
158
+
159
+ Returns:
160
+ str: JSON-formatted string containing table description.
161
+
162
+ Raises:
163
+ CatalogSchemaError: If either catalog or schema is not specified and not configured.
164
+ """
165
+ catalog = catalog or self.config.catalog
166
+ schema = schema or self.config.schema
167
+ if not catalog or not schema:
168
+ raise CatalogSchemaError
169
+ query = f"DESCRIBE {catalog}.{schema}.{table}"
170
+ return self.execute_query(query)
171
+
172
+ def show_create_table(self, catalog: str, schema: str, table: str) -> str:
151
173
  """Show the CREATE TABLE statement for a table.
152
174
 
153
175
  Args:
176
+ schema (str): The schema name. If None, uses configured default.
177
+ catalog (str): The catalog name. If None, uses configured default.
154
178
  table (str): The name of the table.
155
- catalog (Optional[str]): The catalog name. If None, uses configured default.
156
- schema (Optional[str]): The schema name. If None, uses configured default.
157
179
 
158
180
  Returns:
159
181
  str: The CREATE TABLE statement for the specified table.
@@ -164,18 +186,23 @@ class TrinoClient:
164
186
  catalog = catalog or self.config.catalog
165
187
  schema = schema or self.config.schema
166
188
  if not catalog or not schema:
167
- raise CatalogSchemaError()
189
+ raise CatalogSchemaError
168
190
  query = f"SHOW CREATE TABLE {catalog}.{schema}.{table}"
169
191
  result = json.loads(self.execute_query(query))
170
192
  return result[0]["Create Table"] if result else ""
171
193
 
172
- def show_create_view(self, view: str, catalog: str | None = None, schema: str | None = None) -> str:
194
+ def show_create_view(
195
+ self,
196
+ catalog: str,
197
+ schema: str,
198
+ view: str,
199
+ ) -> str:
173
200
  """Show the CREATE VIEW statement for a view.
174
201
 
175
202
  Args:
203
+ catalog (str): The catalog name. If None, uses configured default.
204
+ schema (str): The schema name. If None, uses configured default.
176
205
  view (str): The name of the view.
177
- catalog (Optional[str]): The catalog name. If None, uses configured default.
178
- schema (Optional[str]): The schema name. If None, uses configured default.
179
206
 
180
207
  Returns:
181
208
  str: The CREATE VIEW statement for the specified view.
@@ -186,18 +213,18 @@ class TrinoClient:
186
213
  catalog = catalog or self.config.catalog
187
214
  schema = schema or self.config.schema
188
215
  if not catalog or not schema:
189
- raise CatalogSchemaError()
216
+ raise CatalogSchemaError
190
217
  query = f"SHOW CREATE VIEW {catalog}.{schema}.{view}"
191
218
  result = json.loads(self.execute_query(query))
192
219
  return result[0]["Create View"] if result else ""
193
220
 
194
- def show_stats(self, table: str, catalog: str | None = None, schema: str | None = None) -> str:
221
+ def show_stats(self, catalog: str, schema: str, table: str) -> str:
195
222
  """Show statistics for a table.
196
223
 
197
224
  Args:
225
+ catalog (str): The catalog name. If None, uses configured default.
226
+ schema (str): The schema name. If None, uses configured default.
198
227
  table (str): The name of the table.
199
- catalog (Optional[str]): The catalog name. If None, uses configured default.
200
- schema (Optional[str]): The schema name. If None, uses configured default.
201
228
 
202
229
  Returns:
203
230
  str: JSON-formatted string containing table statistics.
@@ -208,17 +235,17 @@ class TrinoClient:
208
235
  catalog = catalog or self.config.catalog
209
236
  schema = schema or self.config.schema
210
237
  if not catalog or not schema:
211
- raise CatalogSchemaError()
238
+ raise CatalogSchemaError
212
239
  query = f"SHOW STATS FOR {catalog}.{schema}.{table}"
213
240
  return self.execute_query(query)
214
241
 
215
- def optimize(self, table: str, catalog: str | None = None, schema: str | None = None) -> str:
242
+ def optimize(self, catalog: str, schema: str, table: str) -> str:
216
243
  """Optimize an Iceberg table by compacting small files.
217
244
 
218
245
  Args:
246
+ catalog (str): The catalog name. If None, uses configured default.
247
+ schema (str): The schema name. If None, uses configured default.
219
248
  table (str): The name of the table to optimize.
220
- catalog (Optional[str]): The catalog name. If None, uses configured default.
221
- schema (Optional[str]): The schema name. If None, uses configured default.
222
249
 
223
250
  Returns:
224
251
  str: Success message indicating the table was optimized.
@@ -229,12 +256,12 @@ class TrinoClient:
229
256
  catalog = catalog or self.config.catalog
230
257
  schema = schema or self.config.schema
231
258
  if not catalog or not schema:
232
- raise CatalogSchemaError()
259
+ raise CatalogSchemaError
233
260
  query = f"ALTER TABLE {catalog}.{schema}.{table} EXECUTE optimize"
234
261
  self.execute_query(query)
235
262
  return f"Table {catalog}.{schema}.{table} optimized successfully"
236
263
 
237
- def optimize_manifests(self, table: str, catalog: str | None = None, schema: str | None = None) -> str:
264
+ def optimize_manifests(self, table: str, catalog: str, schema: str) -> str:
238
265
  """Optimize manifest files for an Iceberg table.
239
266
 
240
267
  This operation reorganizes and compacts the table's manifest files for improved
@@ -254,17 +281,17 @@ class TrinoClient:
254
281
  catalog = catalog or self.config.catalog
255
282
  schema = schema or self.config.schema
256
283
  if not catalog or not schema:
257
- raise CatalogSchemaError()
284
+ raise CatalogSchemaError
258
285
  query = f"ALTER TABLE {catalog}.{schema}.{table} EXECUTE optimize_manifests"
259
286
  self.execute_query(query)
260
287
  return f"Manifests for table {catalog}.{schema}.{table} optimized successfully"
261
288
 
262
289
  def expire_snapshots(
263
290
  self,
291
+ catalog: str,
264
292
  table: str,
293
+ schema: str,
265
294
  retention_threshold: str = "7d",
266
- catalog: str | None = None,
267
- schema: str | None = None,
268
295
  ) -> str:
269
296
  """Remove old snapshots from an Iceberg table.
270
297
 
@@ -321,7 +348,7 @@ class TrinoClient:
321
348
  tree.append("Unable to list schemas")
322
349
  return "\n".join(tree) if tree else "No catalogs found"
323
350
 
324
- def show_table_properties(self, table: str, catalog: str | None = None, schema: str | None = None) -> str:
351
+ def show_table_properties(self, table: str, catalog: str, schema: str) -> str:
325
352
  """Show Iceberg table properties.
326
353
 
327
354
  Args:
@@ -335,11 +362,12 @@ class TrinoClient:
335
362
  catalog = catalog or self.config.catalog
336
363
  schema = schema or self.config.schema
337
364
  if not catalog or not schema:
338
- raise CatalogSchemaError()
339
- query = f'SELECT * FROM "{catalog}.{schema}.{table}$properties"'
340
- return self.execute_query(query)
365
+ raise CatalogSchemaError
366
+ query = 'SELECT * FROM "{}$properties"'
367
+ table_identifier = f"{catalog}.{schema}.{table}"
368
+ return self.execute_query(query.format(table_identifier))
341
369
 
342
- def show_table_history(self, table: str, catalog: str | None = None, schema: str | None = None) -> str:
370
+ def show_table_history(self, table: str, catalog: str, schema: str) -> str:
343
371
  """Show Iceberg table history/changelog.
344
372
 
345
373
  The history contains:
@@ -359,11 +387,12 @@ class TrinoClient:
359
387
  catalog = catalog or self.config.catalog
360
388
  schema = schema or self.config.schema
361
389
  if not catalog or not schema:
362
- raise CatalogSchemaError()
363
- query = f'SELECT * FROM "{catalog}.{schema}.{table}$history"'
364
- return self.execute_query(query)
390
+ raise CatalogSchemaError
391
+ table_identifier = f"{catalog}.{schema}.{table}"
392
+ query = 'SELECT * FROM "{}$history"'
393
+ return self.execute_query(query.format(table_identifier))
365
394
 
366
- def show_metadata_log_entries(self, table: str, catalog: str | None = None, schema: str | None = None) -> str:
395
+ def show_metadata_log_entries(self, table: str, catalog: str, schema: str) -> str:
367
396
  """Show Iceberg table metadata log entries.
368
397
 
369
398
  The metadata log contains:
@@ -384,11 +413,12 @@ class TrinoClient:
384
413
  catalog = catalog or self.config.catalog
385
414
  schema = schema or self.config.schema
386
415
  if not catalog or not schema:
387
- raise CatalogSchemaError()
388
- query = f'SELECT * FROM "{catalog}.{schema}.{table}$metadata_log_entries"'
389
- return self.execute_query(query)
416
+ raise CatalogSchemaError
417
+ query = 'SELECT * FROM "{}$metadata_log_entries"'
418
+ table_identifier = f"{catalog}.{schema}.{table}"
419
+ return self.execute_query(query.format(table_identifier))
390
420
 
391
- def show_snapshots(self, table: str, catalog: str | None = None, schema: str | None = None) -> str:
421
+ def show_snapshots(self, table: str, catalog: str, schema: str) -> str:
392
422
  """Show Iceberg table snapshots.
393
423
 
394
424
  The snapshots table contains:
@@ -410,13 +440,12 @@ class TrinoClient:
410
440
  catalog = catalog or self.config.catalog
411
441
  schema = schema or self.config.schema
412
442
  if not catalog or not schema:
413
- raise CatalogSchemaError()
414
- query = f'SELECT * FROM "{catalog}.{schema}.{table}$snapshots"'
415
- return self.execute_query(query)
443
+ raise CatalogSchemaError
444
+ table_identifier = f"{catalog}.{schema}.{table}$snapshots"
445
+ query = 'SELECT * FROM "{}"'
446
+ return self.execute_query(query.format(table_identifier))
416
447
 
417
- def show_manifests(
418
- self, table: str, catalog: str | None = None, schema: str | None = None, all_snapshots: bool = False
419
- ) -> str:
448
+ def show_manifests(self, table: str, catalog: str, schema: str, all_snapshots: bool = False) -> str:
420
449
  """Show Iceberg table manifests for current or all snapshots.
421
450
 
422
451
  The manifests table contains:
@@ -444,12 +473,13 @@ class TrinoClient:
444
473
  catalog = catalog or self.config.catalog
445
474
  schema = schema or self.config.schema
446
475
  if not catalog or not schema:
447
- raise CatalogSchemaError()
448
- table_name = f"{catalog}.{schema}.{table}${'all_' if all_snapshots else ''}manifests"
449
- query = f'SELECT * FROM "{table_name}"'
450
- return self.execute_query(query)
476
+ raise CatalogSchemaError
477
+ table_type = "all_manifests" if all_snapshots else "manifests"
478
+ query = 'SELECT * FROM "{}${}"'
479
+ table_identifier = f"{catalog}.{schema}.{table}"
480
+ return self.execute_query(query.format(table_identifier, table_type))
451
481
 
452
- def show_partitions(self, table: str, catalog: str | None = None, schema: str | None = None) -> str:
482
+ def show_partitions(self, table: str, catalog: str, schema: str) -> str:
453
483
  """Show Iceberg table partitions.
454
484
 
455
485
  The partitions table contains:
@@ -470,11 +500,12 @@ class TrinoClient:
470
500
  catalog = catalog or self.config.catalog
471
501
  schema = schema or self.config.schema
472
502
  if not catalog or not schema:
473
- raise CatalogSchemaError()
474
- query = f'SELECT * FROM "{catalog}.{schema}.{table}$partitions"'
475
- return self.execute_query(query)
503
+ raise CatalogSchemaError
504
+ table_identifier = f"{catalog}.{schema}.{table}$partitions"
505
+ query = 'SELECT * FROM "{}"'
506
+ return self.execute_query(query.format(table_identifier))
476
507
 
477
- def show_files(self, table: str, catalog: str | None = None, schema: str | None = None) -> str:
508
+ def show_files(self, table: str, catalog: str, schema: str) -> str:
478
509
  """Show Iceberg table data files in current snapshot.
479
510
 
480
511
  The files table contains:
@@ -504,13 +535,12 @@ class TrinoClient:
504
535
  catalog = catalog or self.config.catalog
505
536
  schema = schema or self.config.schema
506
537
  if not catalog or not schema:
507
- raise CatalogSchemaError()
508
- query = f'SELECT * FROM "{catalog}.{schema}.{table}$files"'
509
- return self.execute_query(query)
538
+ raise CatalogSchemaError
539
+ table_identifier = f"{catalog}.{schema}.{table}$files"
540
+ query = 'SELECT * FROM "{}"'
541
+ return self.execute_query(query.format(table_identifier))
510
542
 
511
- def show_entries(
512
- self, table: str, catalog: str | None = None, schema: str | None = None, all_snapshots: bool = False
513
- ) -> str:
543
+ def show_entries(self, table: str, catalog: str, schema: str, all_snapshots: bool = False) -> str:
514
544
  """Show Iceberg table manifest entries for current or all snapshots.
515
545
 
516
546
  The entries table contains:
@@ -533,12 +563,12 @@ class TrinoClient:
533
563
  catalog = catalog or self.config.catalog
534
564
  schema = schema or self.config.schema
535
565
  if not catalog or not schema:
536
- raise CatalogSchemaError()
566
+ raise CatalogSchemaError
537
567
  table_name = f"{catalog}.{schema}.{table}${'all_' if all_snapshots else ''}entries"
538
- query = f'SELECT * FROM "{table_name}"'
539
- return self.execute_query(query)
568
+ query = 'SELECT * FROM "{}"'
569
+ return self.execute_query(query.format(table_name))
540
570
 
541
- def show_refs(self, table: str, catalog: str | None = None, schema: str | None = None) -> str:
571
+ def show_refs(self, table: str, catalog: str, schema: str) -> str:
542
572
  """Show Iceberg table references (branches and tags).
543
573
 
544
574
  The refs table contains:
@@ -560,6 +590,7 @@ class TrinoClient:
560
590
  catalog = catalog or self.config.catalog
561
591
  schema = schema or self.config.schema
562
592
  if not catalog or not schema:
563
- raise CatalogSchemaError()
564
- query = f'SELECT * FROM "{catalog}.{schema}.{table}$refs"'
565
- return self.execute_query(query)
593
+ raise CatalogSchemaError
594
+ table_identifier = f"{catalog}.{schema}.{table}$refs"
595
+ query = 'SELECT * FROM "{}"'
596
+ return self.execute_query(query.format(table_identifier))