Skip to main content
Glama

CTX: Context as Code (CaC) tool

by context-hub
MIT License
235
  • Apple
  • Linux
DocumentRegistry.php1.63 kB
<?php declare(strict_types=1); namespace Butschster\ContextGenerator\Document; use Butschster\ContextGenerator\Config\Registry\RegistryInterface; /** * @template TDocument of Document * @implements RegistryInterface<TDocument> * @implements \ArrayAccess<array-key, TDocument> */ final class DocumentRegistry implements RegistryInterface, \ArrayAccess { public function __construct( /** @var list<TDocument> */ private array $documents = [], ) {} public function getType(): string { return 'documents'; } /** * Register a document in the registry * @param TDocument $document */ public function register(Document $document): self { $this->documents[] = $document; return $this; } public function getItems(): array { return $this->documents; } public function jsonSerialize(): array { return $this->documents; } public function getIterator(): \Traversable { return new \ArrayIterator($this->getItems()); } public function offsetExists(mixed $offset): bool { return \array_key_exists($offset, $this->documents); } public function offsetGet(mixed $offset): mixed { return $this->documents[$offset] ?? null; } public function offsetSet(mixed $offset, mixed $value): void { throw new \BadMethodCallException('Cannot set value directly. Use register() method.'); } public function offsetUnset(mixed $offset): void { throw new \BadMethodCallException('Cannot unset value directly.'); } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/context-hub/generator'

If you have feedback or need assistance with the MCP directory API, please join our Discord server