Skip to main content
Glama
confluentinc

mcp-confluent

Official
by confluentinc

list-schemas

Retrieve all schemas registered in the Schema Registry. Filter results by latest versions, subject prefixes, or deleted schemas to manage schema organization and compliance effectively.

Instructions

List all schemas in the Schema Registry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseUrlNoThe base URL of the Schema Registry REST API.
deletedNoList deleted schemas.
latestOnlyNoIf true, only return the latest version of each schema.
subjectPrefixNoThe prefix of the subject to list schemas for.

Implementation Reference

  • The ListSchemasHandler class implements the core logic for the 'list-schemas' tool, handling Schema Registry interactions to list schemas with optional filtering and versioning.
    export class ListSchemasHandler extends BaseToolHandler {
      async handle(
        clientManager: ClientManager,
        toolArguments: Record<string, unknown>,
      ): Promise<CallToolResult> {
        const { latestOnly, subjectPrefix, deleted } =
          listSchemasArguments.parse(toolArguments);
    
        logger.debug(
          {
            latestOnly,
            subjectPrefix,
            deleted,
          },
          "ListSchemasHandler.handle called with arguments",
        );
    
        const registry: SchemaRegistryClient =
          clientManager.getSchemaRegistryClient();
    
        try {
          let subjects: string[] = await registry.getAllSubjects();
          logger.debug(
            { subjectsCount: subjects.length },
            "Fetched all subjects from registry",
          );
          if (subjectPrefix) {
            subjects = subjects.filter((s) => s.startsWith(subjectPrefix));
            logger.debug(
              { filteredSubjectsCount: subjects.length, subjectPrefix },
              "Filtered subjects by prefix",
            );
          }
    
          const result: Record<string, unknown> = {};
          for (const subject of subjects) {
            if (latestOnly) {
              try {
                const latest = await registry.getLatestSchemaMetadata(subject);
                logger.debug({ subject, latest }, "Fetched latest schema metadata");
                result[subject] = {
                  version: latest.version,
                  id: latest.id,
                  schemaType: latest.schemaType,
                  schema: latest.schema,
                };
              } catch (err) {
                logger.warn(
                  {
                    subject,
                    error: err instanceof Error ? err.message : String(err),
                  },
                  "Failed to fetch latest schema metadata",
                );
                result[subject] = {
                  error: err instanceof Error ? err.message : String(err),
                };
              }
            } else {
              try {
                const versions: number[] = await registry.getAllVersions(subject);
                logger.debug({ subject, versions }, "Fetched all schema versions");
                result[subject] = [];
                const versionPromises = versions.map(async (version) => {
                  try {
                    const schema = await registry.getSchemaMetadata(
                      subject,
                      version,
                      deleted,
                    );
                    logger.debug(
                      { subject, version, schema },
                      "Fetched schema metadata for version",
                    );
                    (result[subject] as unknown[]).push({
                      version: schema.version,
                      id: schema.id,
                      schemaType: schema.schemaType,
                      schema: schema.schema,
                    });
                  } catch (err) {
                    logger.warn(
                      {
                        subject,
                        version,
                        error: err instanceof Error ? err.message : String(err),
                      },
                      "Failed to fetch schema metadata for version",
                    );
                    (result[subject] as unknown[]).push({
                      version,
                      error: err instanceof Error ? err.message : String(err),
                    });
                  }
                });
                await Promise.all(versionPromises);
              } catch (err) {
                logger.warn(
                  {
                    subject,
                    error: err instanceof Error ? err.message : String(err),
                  },
                  "Failed to fetch all versions for subject",
                );
                result[subject] = {
                  error: err instanceof Error ? err.message : String(err),
                };
              }
            }
          }
          logger.info(
            { subjects: Object.keys(result).length },
            "Returning schema listing result",
          );
          return this.createResponse(JSON.stringify(result));
        } catch (error) {
          logger.error(
            {
              error: error instanceof Error ? error.message : JSON.stringify(error),
            },
            "Failed to list schemas",
          );
          return this.createResponse(
            `Failed to list schemas: ${error instanceof Error ? error.message : JSON.stringify(error)}`,
            true,
          );
        }
      }
    
      getToolConfig(): ToolConfig {
        return {
          name: ToolName.LIST_SCHEMAS,
          description: "List all schemas in the Schema Registry.",
          inputSchema: listSchemasArguments.shape,
        };
      }
    
      getRequiredEnvVars(): EnvVar[] {
        return [
          "SCHEMA_REGISTRY_ENDPOINT",
          "SCHEMA_REGISTRY_API_KEY",
          "SCHEMA_REGISTRY_API_SECRET",
        ];
      }
    }
  • Input schema validation using Zod for the list-schemas tool parameters.
    const listSchemasArguments = z.object({
      latestOnly: z
        .boolean()
        .describe("If true, only return the latest version of each schema.")
        .default(true)
        .optional(),
      subjectPrefix: z
        .string()
        .describe("The prefix of the subject to list schemas for.")
        .optional(),
      deleted: z
        .boolean()
        .describe("List deleted schemas. (Only used if latestOnly is false)")
        .default(false)
        .optional(),
    });
  • Registration of the list-schemas tool handler in the ToolFactory map.
    [ToolName.LIST_SCHEMAS, new ListSchemasHandler()],
  • Enum constant defining the tool name 'list-schemas'.
    LIST_SCHEMAS = "list-schemas",
Behavior2/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 states it's a list operation, implying read-only behavior, but doesn't cover aspects like pagination, rate limits, authentication needs, or what 'all schemas' entails (e.g., scope, format). For a tool with zero annotation coverage, this is a significant gap 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 a single, clear sentence with zero waste—it directly states the tool's purpose without unnecessary words. It's front-loaded and appropriately sized for a simple list operation, earning a top score for efficiency.

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 has no annotations and no output schema, the description is incomplete. It doesn't explain what 'list' returns (e.g., schema details, IDs, versions) or behavioral traits like error handling. For a 4-parameter tool in a registry context, more context is needed to guide effective use.

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

Parameters3/5

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

The description adds no parameter-specific information beyond the schema, which has 100% coverage with detailed descriptions for all 4 parameters. This meets the baseline of 3, as the schema adequately documents parameters like 'deleted' and 'latestOnly', but the description doesn't enhance understanding with examples or contextual usage.

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 ('List') and resource ('all schemas in the Schema Registry'), making the purpose immediately understandable. It distinguishes itself from siblings like 'list-topics' or 'list-connectors' by specifying schemas. However, it doesn't explicitly differentiate from potential schema-related siblings not present in the list, keeping it at 4 rather than 5.

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. It doesn't mention prerequisites, context, or exclusions, such as whether it's for administrative tasks or general discovery. With no usage hints, it leaves the agent to infer based on tool name alone.

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/confluentinc/mcp-confluent'

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