Skip to content

binding-kafka: extend KafkaMetaDataEx with replica and ISR partition detail #1698

@jfallows

Description

@jfallows

Summary

Extend KafkaMetaDataEx and its KafkaPartition element to carry full
partition metadata — replicas, isr, and topic-level replicationFactor
as returned by the Kafka Metadata API (API key 3). Required by the
mcp_kafka tools list_topics, describe_topic, and cluster_overview.

Current types (kafka.idl)

struct KafkaPartition
{
    int32 partitionId;
    int32 leaderId;
}

struct KafkaMetaDataEx
{
    KafkaPartition[] partitions;
}

Required changes

Add a new KafkaPartitionMetadata struct carrying full partition detail, and
extend KafkaMetaDataEx to include topic-level replication factor:

struct KafkaPartitionMetadata
{
    int32 partitionId;
    int32 leaderId;
    int32[] replicas;       // all replica broker IDs
    int32[] isr;            // in-sync replica broker IDs
}

struct KafkaMetaDataEx     // replaces existing KafkaMetaDataEx
{
    int16 replicationFactor;
    KafkaPartitionMetadata[] partitions;
}

KafkaPartition remains unchanged — it is used elsewhere (e.g.
KafkaTopicPartition, KafkaPartition in consumer assignment structs).
KafkaMetaDataEx is updated in place; existing callers that only read
partitionId and leaderId must be updated to use KafkaPartitionMetadata.

Kafka API

Metadata (API key 3) — already in KafkaApi enum and KafkaBeginEx.

Spec test coverage

Add scenarios to specs/binding-kafka.spec/ covering:

  • Metadata response with replicationFactor, replicas, and isr correctly
    populated in KafkaMetaDataEx
  • isr subset of replicas for an under-replicated partition

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions