Skip to main content
Glama
bpamiri

CockroachDB MCP Server

by bpamiri

rollback_transaction

Cancel pending database changes by aborting the current transaction, restoring data to its previous state.

Instructions

Rollback the current transaction.

Returns:
    Rollback status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler and registration for 'rollback_transaction'. This is the entry point for the tool, decorated with @mcp.tool() and delegates to the connection manager.
    @mcp.tool()
    async def rollback_transaction() -> dict[str, Any]:
        """Rollback the current transaction.
    
        Returns:
            Rollback status.
        """
        try:
            return await connection_manager.rollback_transaction()
        except Exception as e:
            return {"status": "error", "error": str(e)}
  • Core implementation of rollback_transaction in the ConnectionManager class. Performs the actual database rollback and state management.
    async def rollback_transaction(self) -> dict[str, Any]:
        """Rollback the current transaction.
    
        Returns:
            Rollback status.
        """
        conn = await self.ensure_connected()
    
        if not self._state.in_transaction:
            return {"status": "error", "error": "No transaction in progress"}
    
        try:
            await conn.rollback()
            await conn.set_autocommit(True)
            self._state.in_transaction = False
            return {"status": "rolled_back", "message": "Transaction rolled back"}
        except Exception as e:
            return {"status": "error", "error": str(e)}
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the action ('Rollback') but doesn't explain what this entails (e.g., whether it's destructive, requires specific permissions, affects data integrity, or has side effects). The return value mention is minimal and doesn't add meaningful context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief and front-loaded with the core purpose in the first sentence. The second sentence about returns is somewhat redundant given the output schema, but it doesn't significantly detract from efficiency. Overall, it's appropriately sized with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a transactional operation with potential data implications), the description is minimal. It lacks behavioral details (e.g., destructive nature, prerequisites) that are crucial for safe use, though the presence of an output schema mitigates some gaps. It's adequate but has clear room for improvement.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the absence of inputs. The description doesn't need to add parameter semantics, and it appropriately doesn't mention any, earning a baseline score of 4 for this context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Rollback') and target ('the current transaction'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'commit_transaction' or 'cancel_query', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'commit_transaction' or 'cancel_query', nor does it mention prerequisites (e.g., needing an active transaction). It only states what the tool does, not when it should be invoked.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bpamiri/cockroachdb-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server