Skip to main content
Glama
aywengo

MCP Kafka Schema Reg

bulk_schema_cleanup

Clean up Kafka schemas in bulk with safety checks, including active consumer detection. Supports test schema cleanup, deprecated schema removal, and version purging with configurable options.

Instructions

Clean up schemas in bulk with safety checks.

Detects active consumers and provides options for handling them. Supports test schema cleanup, deprecated schema removal, and version purging.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
check_consumersNo
cleanup_typeNotest
forceNo
keep_versionsNo
patternNo

Implementation Reference

  • Core handler for bulk schema cleanup operations. Orchestrates elicitation of cleanup type, items, options, preview, consumer checks, confirmation, and execution.
    async def _handle_bulk_cleanup(self) -> Dict[str, Any]:
        """Handle bulk cleanup operations"""
        # Step 1: Select cleanup type
        cleanup_type = await self._elicit_cleanup_type()
    
        # Step 2: Select items to clean up
        items = await self._elicit_cleanup_items(cleanup_type)
    
        # Step 3: Cleanup options
        cleanup_options = await self._elicit_cleanup_options(cleanup_type)
    
        # Step 4: Preview cleanup
        preview = await self._generate_preview(
            BulkOperationType.CLEANUP, items, {"cleanup_type": cleanup_type, **cleanup_options}
        )
    
        # Step 5: Safety check for active consumers
        if preview.consumer_impact:
            action = await self._elicit_consumer_impact_action(preview.consumer_impact)
            if action == "cancel":
                return {"status": "cancelled", "reason": "Active consumers detected"}
            cleanup_options["consumer_action"] = action
    
        # Step 6: Confirm operation
        if not await self._confirm_operation(preview, extra_warnings=True):
            return {"status": "cancelled", "reason": "User cancelled operation"}
    
        # Step 7: Execute cleanup
        return await self._execute_bulk_operation(
            BulkOperationType.CLEANUP, items, {"cleanup_type": cleanup_type, **cleanup_options}, preview
        )
  • Input schema validation for the bulk_schema_cleanup tool, defining parameters like cleanup_type, pattern, keep_versions, check_consumers, and force.
    inputSchema={
        "type": "object",
        "properties": {
            "cleanup_type": {
                "type": "string",
                "enum": ["test", "deprecated", "old_versions", "pattern"],
                "description": "Type of cleanup to perform",
            },
            "pattern": {
                "type": "string",
                "description": "Custom pattern for cleanup (if cleanup_type is 'pattern')",
            },
            "keep_versions": {
                "type": "integer",
                "default": 3,
                "description": "Number of recent versions to keep",
            },
            "check_consumers": {
                "type": "boolean",
                "default": True,
                "description": "Check for active consumers before cleanup",
            },
            "force": {
                "type": "boolean",
                "default": False,
                "description": "Force cleanup even with active consumers (dangerous)",
            },
        },
        "required": ["cleanup_type"],
    },
  • MCP tool registration for bulk_schema_cleanup, including name, description, and schema.
    tools.append(
        Tool(
            name="bulk_schema_cleanup",
            description=(
                "Clean up schemas in bulk with safety checks. "
                "Detects active consumers and provides options for handling them. "
                "Supports test schema cleanup, deprecated schema removal, and version purging."
            ),
            inputSchema={
                "type": "object",
                "properties": {
                    "cleanup_type": {
                        "type": "string",
                        "enum": ["test", "deprecated", "old_versions", "pattern"],
                        "description": "Type of cleanup to perform",
                    },
                    "pattern": {
                        "type": "string",
                        "description": "Custom pattern for cleanup (if cleanup_type is 'pattern')",
                    },
                    "keep_versions": {
                        "type": "integer",
                        "default": 3,
                        "description": "Number of recent versions to keep",
                    },
                    "check_consumers": {
                        "type": "boolean",
                        "default": True,
                        "description": "Check for active consumers before cleanup",
                    },
                    "force": {
                        "type": "boolean",
                        "default": False,
                        "description": "Force cleanup even with active consumers (dangerous)",
                    },
                },
                "required": ["cleanup_type"],
            },
        )
    )
  • MCP dispatch handler for bulk_schema_cleanup tool call, delegates to BulkOperationsWizard.start_wizard with CLEANUP type.
    elif tool_name == "bulk_schema_cleanup":
        # Direct cleanup with parameters
        return await wizard.start_wizard(BulkOperationType.CLEANUP)
  • Registers the cleanup handler (_handle_bulk_cleanup) for BulkOperationType.CLEANUP in the wizard's operation handlers dictionary.
    def _register_handlers(self) -> Dict[BulkOperationType, Callable]:
        """Register operation handlers"""
        return {
            BulkOperationType.SCHEMA_UPDATE: self._handle_bulk_schema_update,
            BulkOperationType.MIGRATION: self._handle_bulk_migration,
            BulkOperationType.CLEANUP: self._handle_bulk_cleanup,
            BulkOperationType.CONFIGURATION: self._handle_bulk_configuration,
        }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'safety checks' and 'detects active consumers and provides options for handling them,' which adds valuable context about the tool's cautious approach and interactive elements. However, it doesn't detail what happens during cleanup (e.g., irreversible deletion, audit trails), permissions required, rate limits, or error handling, leaving significant gaps for a bulk mutation tool.

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 efficiently structured in three sentences: an overview, a key feature, and supported scenarios. Each sentence adds value without redundancy. While it could be slightly more detailed given the tool's complexity, it avoids fluff and is appropriately front-loaded with the core purpose.

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

Completeness2/5

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

Given the tool's complexity (bulk schema cleanup with 5 parameters), lack of annotations, 0% schema description coverage, and no output schema, the description is insufficiently complete. It omits critical details: what the tool returns, how 'active consumers' are handled, the meaning of 'force' or 'pattern,' and the full behavioral implications of a bulk mutation operation. More context is needed for safe and effective use.

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

Parameters2/5

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

The input schema has 5 parameters with 0% description coverage, meaning no schema-level documentation. The description mentions 'safety checks' (hinting at 'check_consumers' and 'force'), 'test schema cleanup, deprecated schema removal, and version purging' (relating to 'cleanup_type' and 'keep_versions'), and 'schemas' (possibly linking to 'pattern'). However, it doesn't fully explain each parameter's role, acceptable values (e.g., what 'cleanup_type' options are), or interactions, failing to compensate adequately for the schema's lack of descriptions.

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 tool's purpose: 'Clean up schemas in bulk with safety checks.' It specifies the action (clean up), resource (schemas), scope (bulk), and safety aspect. While it distinguishes itself from siblings like 'bulk_schema_migration' or 'bulk_schema_update' by focusing on cleanup rather than migration or updates, it doesn't explicitly contrast with these alternatives in the description text itself.

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

Usage Guidelines3/5

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

The description implies usage context through 'with safety checks' and mentions specific cleanup scenarios: 'test schema cleanup, deprecated schema removal, and version purging.' However, it doesn't provide explicit guidance on when to use this tool versus alternatives like 'delete_subject' or 'bulk_schema_migration,' nor does it specify prerequisites or exclusions for use.

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

Related 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/aywengo/kafka-schema-reg-mcp'

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