Skip to content

[Server] listChanged is not announced for a registry wired to the bus by the caller #607

Closed

Description

@chr-hertel

#593 was too strict, my bad: listChanged is only announced with the built-in registry now, since a registry passed via setRegistry() "can't be wired to the bus". But the caller can wire it - symfony/mcp-bundle does exactly that:

$bus = new InMemoryNotificationBus();
$registry = new Registry(new PublishingEventDispatcher($bus));

$server = Server::builder()
    ->setServerInfo('test', '1.0.0')
    ->setRegistry($registry)
    ->setNotificationBus($bus)
    ->build();

$registry->registerTool($tool, $handler);

The notifications/tools/list_changed reaches the bus, but toolsListChanged is false => server/discover drops listChanged, subscriptions/listen agrees to none of the list-change types, and bundle users lose list-change notifications on 2026-07-28 altogether.

Options I see:

a) announce listChanged for a registry from setRegistry() as long as a bus is set, and keep it off initialize as #593 does
b) let the caller say so explicitly, e.g. setRegistry($registry, publishesChanges: true)
c) the bundle calls setCapabilities() - works, but every bundle server gives up capability detection for it

I'd go with b), a) would bring back the false announcement from chr-hertel#76. WDYT @Nyholm @CodeWithKyrian?

Activity

  1. chr-hertel commented on Oct 18, 2026

    @chr-hertel
    MemberAuthor

    Went with neither in the end - the registry says it itself now via RegistryInterface::publishesListChanges(), see #608. Registry returns true when its dispatcher is a PublishingEventDispatcher, so the bundle gets listChanged back without any change.

    BC break for other implementations, but the ones out there are decorators and just forward to the inner registry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions