Summary
Add ALTER_CONSUMER_GROUP_OFFSETS (API key 53) to the KafkaApi enum and
KafkaRequestBeginEx / KafkaResponseBeginEx unions. Required by the
mcp_kafka reset_offsets tool.
This API (introduced in Kafka 2.7) allows an admin client to reset committed
offsets for a consumer group. The group must be inactive (no running members)
at the time of the call — the Kafka broker returns NON_EMPTY_GROUP (error
code 68) if members are still active.
Required changes to kafka.idl
Add to KafkaApi enum:
ALTER_CONSUMER_GROUP_OFFSETS (53)
Add new request and response structs:
struct KafkaAlterGroupTopicPartition
{
int32 partitionId;
int64 offset;
int32 leaderEpoch = -1;
string16 metadata = null;
}
struct KafkaAlterGroupTopic
{
string16 name;
KafkaAlterGroupTopicPartition[] partitions;
}
struct KafkaAlterConsumerGroupOffsetsRequestBeginEx
{
string16 groupId;
KafkaAlterGroupTopic[] topics;
}
struct KafkaAlterGroupPartitionResult
{
int32 partitionId;
int16 error;
}
struct KafkaAlterGroupTopicResult
{
string16 name;
KafkaAlterGroupPartitionResult[] partitions;
}
struct KafkaAlterConsumerGroupOffsetsResponseBeginEx
{
int32 throttle;
KafkaAlterGroupTopicResult[] topics;
}
Add to KafkaRequestBeginEx union:
case 53: kafka::stream::KafkaAlterConsumerGroupOffsetsRequestBeginEx alterConsumerGroupOffsets;
Add to KafkaResponseBeginEx union:
case 53: kafka::stream::KafkaAlterConsumerGroupOffsetsResponseBeginEx alterConsumerGroupOffsets;
Notes
- The
offset field carries the resolved offset value. Resolution of
"earliest" and "latest" symbolic offsets to concrete values is the
responsibility of mcp_kafka — it calls KafkaFetchBeginEx (for latest)
or uses offset 0 (for earliest) before constructing the
AlterConsumerGroupOffsets request.
- If
NON_EMPTY_GROUP error is returned, mcp_kafka surfaces a clear error
to the agent: "Consumer group must be inactive before resetting offsets."
Spec test coverage
Add scenarios to specs/binding-kafka.spec/ covering:
- Successful offset reset for a single partition
- Successful offset reset for all partitions on a topic (multiple entries)
- Error:
NON_EMPTY_GROUP (error code 68) — group has active members
- Error:
GROUP_AUTHORIZATION_FAILED
Additional context
Summary
Add
ALTER_CONSUMER_GROUP_OFFSETS(API key 53) to theKafkaApienum andKafkaRequestBeginEx/KafkaResponseBeginExunions. Required by themcp_kafkareset_offsetstool.This API (introduced in Kafka 2.7) allows an admin client to reset committed
offsets for a consumer group. The group must be inactive (no running members)
at the time of the call — the Kafka broker returns
NON_EMPTY_GROUP(errorcode 68) if members are still active.
Required changes to kafka.idl
Add to
KafkaApienum:Add new request and response structs:
Add to
KafkaRequestBeginExunion:Add to
KafkaResponseBeginExunion:Notes
offsetfield carries the resolved offset value. Resolution of"earliest"and"latest"symbolic offsets to concrete values is theresponsibility of
mcp_kafka— it callsKafkaFetchBeginEx(for latest)or uses offset 0 (for earliest) before constructing the
AlterConsumerGroupOffsetsrequest.NON_EMPTY_GROUPerror is returned,mcp_kafkasurfaces a clear errorto the agent: "Consumer group must be inactive before resetting offsets."
Spec test coverage
Add scenarios to
specs/binding-kafka.spec/covering:NON_EMPTY_GROUP(error code 68) — group has active membersGROUP_AUTHORIZATION_FAILEDAdditional context