1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * This file is part of the Nexus MCP SDK package.
7: *
8: * (c) 2026 John Paul E. Balandan, CPA <paulbalandan@gmail.com>
9: *
10: * For the full copyright and license information, please view
11: * the LICENSE file that was distributed with this source code.
12: */
13:
14: namespace Nexus\Mcp\Core\Schema\Result;
15:
16: use Nexus\Mcp\Core\Schema\Cursor;
17: use Nexus\Mcp\Core\Schema\Enum\CacheScope;
18: use Nexus\Mcp\Core\Schema\MetaObject\GenericResultMetaObject;
19: use Nexus\Mcp\Core\Schema\MetaObject\ResultMetaObject;
20:
21: /**
22: * Common shape for results that paginate via an opaque cursor. Subclasses add their own
23: * payload field alongside the optional `nextCursor`.
24: *
25: * @template-covariant T of array<string, mixed>
26: *
27: * @extends CacheableResult<T>
28: *
29: * @see https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2026-07-28/schema.ts
30: */
31: abstract readonly class PaginatedResult extends CacheableResult
32: {
33: public function __construct(
34: int $ttlMs,
35: CacheScope $cacheScope,
36: public ?Cursor $nextCursor = null,
37: ResultMetaObject $meta = new GenericResultMetaObject(),
38: ) {
39: parent::__construct(ttlMs: $ttlMs, cacheScope: $cacheScope, meta: $meta);
40: }
41: }
42: