Skip to main content
Glama

CTX: Context as Code (CaC) tool

by context-hub
MIT License
235
  • Apple
  • Linux
BaseSource.php1.34 kB
<?php declare(strict_types=1); namespace Butschster\ContextGenerator\Source; use Butschster\ContextGenerator\Modifier\ModifiersApplierInterface; use Butschster\ContextGenerator\SourceParserInterface; abstract class BaseSource implements SourceInterface { /** * @param string $description Human-readable description */ public function __construct( protected readonly string $description, protected readonly array $tags = [], ) {} public function getDescription(): string { return \trim($this->description); } public function hasDescription(): bool { return $this->getDescription() !== ''; } public function getTags(): array { return \array_values(\array_unique($this->tags)); } public function hasTags(): bool { return !empty($this->getTags()); } public function parseContent( SourceParserInterface $parser, ModifiersApplierInterface $modifiersApplier, ): string { return $parser->parse($this, $modifiersApplier); } public function jsonSerialize(): array { return \array_filter([ 'description' => $this->getDescription(), 'tags' => $this->getTags(), ], static fn($value) => $value !== null && $value !== '' && $value !== []); } }

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