Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ All notable changes to `mcp/sdk` will be documented in this file.
* Fix `InMemorySessionStore::exists()` reporting a session past its TTL as existing, while `read()` already treated it as gone.
* Fix `Psr16NotificationBus` subscribers missing the notifications published after the bus stayed quiet for longer than its TTL: the sequence counter no longer expires, and a subscriber whose cursor is ahead of a lost counter reads what the bus holds.
* Fix `Session::save()` wiping the other keys of a session that the store failed to read, e.g. when `Psr16SessionStore` hits a cache error: it now returns `false` instead of writing the changed keys alone.
* Fix `EnumCompletionProvider` and `ListCompletionProvider` offering all values for the prefix `"0"` instead of only the values that start with it.
* Add `Psr6SessionStore` and `Psr6NotificationBus`, which work like `Psr16SessionStore` and `Psr16NotificationBus` over a PSR-6 cache pool. `Builder::setDiscovery()` also accepts a PSR-6 pool as `$cache`.

### Client
Expand Down
2 changes: 1 addition & 1 deletion src/Capability/Completion/EnumCompletionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(string $enumClass)

public function getCompletions(string $currentValue): array
{
if (empty($currentValue)) {
if ('' === $currentValue) {
return $this->values;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Capability/Completion/ListCompletionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(array $values)

public function getCompletions(string $currentValue): array
{
if (empty($currentValue)) {
if ('' === $currentValue) {
return $this->values;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@ public function testPrefixMatchesKeepCaseOrder(): void
$this->assertSame([], $provider->getCompletions('missing'));
}

public function testZeroPrefixOffersAllCases(): void
public function testEmptyPrefixOffersAllCases(): void
{
$provider = new EnumCompletionProvider(CompletionFixture::class);

$this->assertSame(['alpha', 'alpine', 'algebra', '0'], $provider->getCompletions('0'));
$this->assertSame(['alpha', 'alpine', 'algebra', '0'], $provider->getCompletions(''));
}

public function testZeroIsMatchedAsPrefix(): void
{
$provider = new EnumCompletionProvider(CompletionFixture::class);

$this->assertSame(['0'], $provider->getCompletions('0'));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ public function testNumericValuesBecomeStrings(): void
$this->assertSame(['101', '102.5'], $provider->getCompletions('10'));
}

public function testZeroIsMatchedAsPrefix(): void
{
$provider = new ListCompletionProvider(['zero', '0', '01']);

$this->assertSame(['0', '01'], $provider->getCompletions('0'));
}

public function testKeysAreDiscarded(): void
{
$provider = new ListCompletionProvider([5 => 'a', 9 => 'b']);
Expand Down
Loading