Skip to content

Commit 2256de2

Browse files
Merge pull request #29 from Youssef-Erradi/refactor/consolidate-db-operator-tools
consolidate table and transaction tools using action enum
2 parents acac000 + 0e3edfa commit 2256de2

File tree

4 files changed

+242
-290
lines changed

4 files changed

+242
-290
lines changed

src/oracle-db-mcp-java-toolkit/README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ The server provides four built-in toolsets that can be enabled via `-Dtools`:
137137
<td><code>database-operator</code></td>
138138
<td>Database operations, transactions, monitoring, and execution plans</td>
139139
<td>
140-
read-query, write-query, create-table, delete-table,
141-
list-tables, describe-table, start-transaction, resume-transaction,
142-
commit-transaction, rollback-transaction, db-ping,
140+
read-query, write-query, table, transaction, db-ping,
143141
db-metrics-range, explain-plan
144142
</td>
145143
</tr>
@@ -168,20 +166,20 @@ These tools provide direct SQL execution capabilities:
168166
- **`write-query`**: Execute DML/DDL operations (INSERT, UPDATE, DELETE, CREATE, etc.) with autocommit.
169167

170168
### 3.2. Table Management
171-
These tools help you manage database tables:
169+
A single **`table`** tool covers all table management operations via an `action` parameter:
172170

173-
- **`create-table`**: Create a table using full CREATE TABLE statements
174-
- **`delete-table`**: Drop an existing table by name
175-
- **`list-tables`**: List all tables and synonyms in the current schema
176-
- **`describe-table`**: Get detailed column information for any table
171+
- **`action=create`**: Create a table using full CREATE TABLE statements
172+
- **`action=drop`**: Drop an existing table by name (`table` required)
173+
- **`action=list`**: List all tables and synonyms in the current schema
174+
- **`action=describe`**: Get detailed column information for any table (`table` required)
177175

178176
### 3.3. Transaction Management
179-
These tools provide fine-grained control over database transactions:
177+
A single **`transaction`** tool covers all transaction lifecycle operations via an `action` parameter:
180178

181-
- **`start-transaction`**: Begin a new JDBC transaction and get a transaction ID
182-
- **`resume-transaction`**: Verify if a transaction ID is still active
183-
- **`commit-transaction`**: Commit and close a transaction
184-
- **`rollback-transaction`**: Rollback and close a transaction
179+
- **`action=start`**: Begin a new JDBC transaction and get a transaction ID
180+
- **`action=resume`**: Verify if a transaction ID is still active (`txId` required)
181+
- **`action=commit`**: Commit and close a transaction (`txId` required)
182+
- **`action=rollback`**: Rollback and close a transaction (`txId` required)
185183

186184
### 3.4. Database Monitoring
187185
These tools help monitor database health and performance:
@@ -544,7 +542,7 @@ Ultimately, the token must be included in the http request header (e.g. `Authori
544542
You can pass individual tools (e.g. <code>get-jdbc-stats</code>, <code>read-query</code>) or any of the following built-in toolsets:
545543
<ul>
546544
<li><code>mcp-admin</code> — server discovery and runtime configuration tools (list-tools, edit-tools)</li>
547-
<li><code>database-operator</code> — database operations, transactions, monitoring, and execution plans (read-query, write-query, create-table, delete-table, list-tables, describe-table, start-transaction, resume-transaction, commit-transaction, rollback-transaction, db-ping, db-metrics-range, explain-plan).</li>
545+
<li><code>database-operator</code> — database operations, transactions, monitoring, and execution plans (read-query, write-query, table, transaction, db-ping, db-metrics-range, explain-plan).</li>
548546
<li><code>log-analyzer</code> — all JDBC log and RDBMS/SQLNet analysis tools (get-jdbc-stats, get-jdbc-queries, get-jdbc-errors, list-log-files-from-directory, jdbc-log-comparison, get-jdbc-connection-events, get-rdbms-errors, get-rdbms-packet-dumps)</li>
549547
<li><code>rag</code> — similarity-search</li>
550548
</ul>

src/oracle-db-mcp-java-toolkit/src/main/java/com/oracle/database/mcptoolkit/ServerConfig.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ private ServerConfig(
6161
}
6262

6363
private static final Set<String> DB_TOOLS = Set.of(
64-
"similarity-search", "explain-plan",
65-
"read-query", "write-query", "create-table", "delete-table",
66-
"list-tables", "describe-table", "start-transaction", "resume-transaction",
67-
"commit-transaction", "rollback-transaction", "db-ping", "db-metrics-range"
64+
"similarity-search", "explain-plan", "read-query", "write-query",
65+
"transaction", "table", "db-ping", "db-metrics-range"
6866
);
6967

7068
/** Built-in toolsets covering predefined tools. Lowercase keys and members. */
@@ -81,9 +79,7 @@ private ServerConfig(
8179
),
8280
"rag", Set.of("similarity-search"),
8381
"database-operator", Set.of(
84-
"read-query", "write-query", "create-table", "delete-table",
85-
"list-tables", "describe-table", "start-transaction", "resume-transaction",
86-
"commit-transaction", "rollback-transaction", "db-ping", "db-metrics-range",
82+
"read-query", "write-query", "transaction", "table", "db-ping", "db-metrics-range",
8783
"explain-plan"
8884
),
8985
"mcp-admin", Set.of("list-tools", "edit-tools")

0 commit comments

Comments
 (0)