rollback-transaction
Revert a specific transaction in Microsoft SQL Server by specifying its ID using this tool, ensuring database integrity and resolving unintended changes.
Instructions
Rollback a transaction
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| transactionId | Yes | The ID of the transaction to rollback. |
Implementation Reference
- src/tools/transactions.ts:56-66 (handler)Handler function that retrieves the transaction from the map, calls rollback on it, deletes from map, and returns success message.async rollbackTransaction({ transactionId }: { transactionId: string }) { const transaction = this.transactions.get(transactionId); if (!transaction) { throw new Error(`Transaction with ID ${transactionId} not found.`); } await transaction.rollback(); this.transactions.delete(transactionId); return this.toResult(`Transaction with ID ${transactionId} rolled back successfully.`); }
- src/tools/transactions.ts:26-31 (registration)Registers the rollback-transaction tool with the MCP server, including description, input schema, and handler binding.server.tool( "rollback-transaction", "Rollback a transaction", { transactionId: z.string().describe("The ID of the transaction to rollback.") }, tools.rollbackTransaction.bind(tools), );
- src/tools/transactions.ts:29-29 (schema)Zod schema defining the input parameter transactionId as a string.{ transactionId: z.string().describe("The ID of the transaction to rollback.") },