Skip to main content
Glama
bpamiri

CockroachDB MCP Server

by bpamiri

cancel_query

Stop a running query in CockroachDB by providing its query ID to manage database performance and resource usage.

Instructions

Cancel a running query.

Args: query_id: The query ID to cancel. Returns: Cancellation result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
query_idYes

Implementation Reference

  • MCP tool handler for cancel_query, registered via @mcp.tool() decorator, handles errors and delegates to cluster.cancel_query implementation.
    @mcp.tool() async def cancel_query(query_id: str) -> dict[str, Any]: """Cancel a running query. Args: query_id: The query ID to cancel. Returns: Cancellation result. """ try: return await cluster.cancel_query(query_id) except Exception as e: return {"status": "error", "error": str(e)}
  • Core helper function that executes the CANCEL QUERY SQL command on the CockroachDB connection.
    async def cancel_query(query_id: str) -> dict[str, Any]: """Cancel a running query. Args: query_id: The query ID to cancel. Returns: Cancellation result. """ conn = await connection_manager.ensure_connected() try: async with conn.cursor() as cur: await cur.execute(f"CANCEL QUERY '{query_id}'") return { "status": "success", "query_id": query_id, "message": "Query cancelled", } except Exception as e: return {"status": "error", "error": str(e)}

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