Skip to main content
Glama

CTX: Context as Code (CaC) tool

by context-hub
MIT License
235
  • Apple
  • Linux
SourceWithModifiers.php1.32 kB
<?php declare(strict_types=1); namespace Butschster\ContextGenerator\Source; use Butschster\ContextGenerator\Modifier\Modifier; use Butschster\ContextGenerator\Modifier\ModifiersApplierInterface; use Butschster\ContextGenerator\SourceParserInterface; abstract class SourceWithModifiers extends BaseSource { /** * @param array<non-empty-string> $tags * @param array<Modifier> $modifiers Identifiers for content modifiers to apply */ public function __construct( string $description, array $tags = [], public readonly array $modifiers = [], ) { parent::__construct(description: $description, tags: $tags); } #[\Override] public function parseContent( SourceParserInterface $parser, ModifiersApplierInterface $modifiersApplier, ): string { // If we have source-specific modifiers and a document-level modifiers applier, // create a new applier that includes both sets of modifiers $modifiersApplier = $modifiersApplier->withModifiers($this->modifiers); return $parser->parse($this, $modifiersApplier); } #[\Override] public function jsonSerialize(): array { return [ ...parent::jsonSerialize(), 'modifiers' => $this->modifiers, ]; } }

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