Skip to main content
Glama

CTX: Context as Code (CaC) tool

by context-hub
MIT License
235
  • Apple
  • Linux
ContextSanitizer.php934 B
<?php declare(strict_types=1); namespace Butschster\ContextGenerator\Modifier\Sanitizer\Rule; final class ContextSanitizer { /** * @param array<string, RuleInterface> $rules Collection of sanitization rules */ public function __construct( private array $rules = [], ) {} /** * Register a sanitization rule */ public function addRule(RuleInterface $rule): self { $this->rules[$rule->getName()] = $rule; return $this; } /** * Get all registered rules * * @return array<string, RuleInterface> */ public function getRules(): array { return $this->rules; } /** * Sanitize a context file and save the result */ public function sanitize(string $content): string { foreach ($this->rules as $rule) { $content = $rule->apply($content); } return $content; } }

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