Skip to main content
Glama
aywengo

MCP Kafka Schema Reg

list_contexts

Retrieve all available schema contexts in MCP Kafka Schema Reg. Use this tool for backward compatibility, or switch to 'registry://{name}/contexts' for improved performance.

Instructions

List all available schema contexts.

NOTE: This tool is maintained for backward compatibility. Consider using the 'registry://{name}/contexts' resource instead for better performance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
registryNo

Implementation Reference

  • Handler function for the 'list_contexts' tool. Queries the Schema Registry /contexts endpoint (or uses client.get_contexts() in multi-mode), formats the response with registry metadata, MCP version, and adds HATEOAS links using add_links_to_response.
    @structured_output("list_contexts", fallback_on_error=True)
    def list_contexts_tool(
        registry_manager,
        registry_mode: str,
        registry: Optional[str] = None,
        auth=None,
        headers=None,
        schema_registry_url: str = "",
    ) -> Dict[str, Any]:
        """
        List all available schema contexts.
    
        Args:
            registry: Optional registry name (ignored in single-registry mode)
    
        Returns:
            Dictionary containing context names with structured validation and resource links
        """
        try:
            if registry_mode == "single":
                # Single-registry mode: use secure session approach
                client = registry_manager.get_registry()
                if client is None:
                    return create_error_response(
                        "No default registry configured",
                        error_code="REGISTRY_NOT_FOUND",
                        registry_mode="single",
                    )
    
                response = client.session.get(f"{client.config.url}/contexts", auth=client.auth, headers=client.headers)
                response.raise_for_status()
                contexts_list = response.json()
    
                # Convert to enhanced response format
                result = {
                    "contexts": contexts_list,
                    "registry_mode": "single",
                    "mcp_protocol_version": "2025-06-18",
                }
    
                # Add resource links
                registry_name = _get_registry_name(registry_mode, registry)
                result = add_links_to_response(result, "contexts_list", registry_name)
    
                return result
            else:
                # Multi-registry mode: use client approach
                client = registry_manager.get_registry(registry)
                if client is None:
                    return create_error_response(
                        f"Registry '{registry}' not found",
                        error_code="REGISTRY_NOT_FOUND",
                        registry_mode="multi",
                    )
    
                contexts_list = client.get_contexts()
    
                # Convert to enhanced response format
                result = {
                    "contexts": contexts_list,
                    "registry": client.config.name,
                    "registry_mode": "multi",
                    "mcp_protocol_version": "2025-06-18",
                }
    
                # Add resource links
                result = add_links_to_response(result, "contexts_list", client.config.name)
    
                return result
        except Exception as e:
            return create_error_response(str(e), error_code="CONTEXT_LIST_FAILED", registry_mode=registry_mode)
  • JSON Schema definition for the output of list_contexts tool, including required 'contexts' array, optional registry field, _links for HATEOAS, and shared METADATA_FIELDS.
    LIST_CONTEXTS_SCHEMA = {
        "type": "object",
        "properties": {
            "contexts": {
                "type": "array",
                "items": {"type": "string"},
                "description": "List of context names",
            },
            "registry": {
                "type": "string",
                "description": "Registry name (multi-registry mode)",
            },
            "_links": {
                "type": "object",
                "description": "Navigation links to related resources",
                "additionalProperties": True,
            },
            **METADATA_FIELDS,
        },
        "required": ["contexts"],
        "additionalProperties": True,
    }
  • Registration of the list_contexts output schema in the master TOOL_OUTPUT_SCHEMAS dictionary used for validation.
    "list_contexts": LIST_CONTEXTS_SCHEMA,
Behavior3/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions backward compatibility and a performance alternative, which adds useful context about the tool's maintenance status. However, it doesn't describe key behaviors like whether it's read-only, how it handles errors, or what the output format is, leaving gaps in transparency.

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

Conciseness5/5

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

The description is highly concise and well-structured: two sentences that directly state the purpose and provide critical usage notes. Every sentence adds value without redundancy, making it efficient and front-loaded with essential information.

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 low complexity (one parameter, no output schema, no annotations), the description is somewhat complete for a simple listing tool. It covers purpose and usage guidelines well, but lacks details on parameters and behavioral aspects, making it adequate but with clear gaps.

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 one parameter ('registry') with 0% description coverage, and the tool description provides no information about parameters. It doesn't explain what 'registry' means, its purpose, or how it affects the listing. With low schema coverage and no compensation in the description, this falls below the baseline.

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: 'List all available schema contexts.' It specifies the verb ('List') and resource ('schema contexts'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'count_contexts' or 'list_subjects', 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 Guidelines5/5

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

The description provides explicit usage guidance: it notes this tool is 'maintained for backward compatibility' and recommends using 'registry://{name}/contexts' instead for better performance. This clearly indicates when to use this tool (for compatibility) versus an alternative (for performance), meeting the highest criteria.

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