Skip to main content
Glama

CTX: Context as Code (CaC) tool

by context-hub
MIT License
235
  • Apple
  • Linux
JsonSchemaResourceAction.php1.46 kB
<?php declare(strict_types=1); namespace Butschster\ContextGenerator\McpServer\Action\Resources; use Butschster\ContextGenerator\Application\Logger\LoggerPrefix; use Butschster\ContextGenerator\McpServer\Action\Resources\Service\JsonSchemaService; use Butschster\ContextGenerator\McpServer\Attribute\Resource; use Butschster\ContextGenerator\McpServer\Routing\Attribute\Get; use PhpMcp\Schema\Content\TextResourceContents; use PhpMcp\Schema\Result\ReadResourceResult; use Psr\Http\Message\ServerRequestInterface; use Psr\Log\LoggerInterface; #[Resource( name: 'CTX app Json Schema', description: 'Returns a simplified JSON schema of CTX', uri: 'ctx://json-schema', mimeType: 'application/json', )] final readonly class JsonSchemaResourceAction { public function __construct( #[LoggerPrefix(prefix: 'resources.ctx.json-schema')] private LoggerInterface $logger, private JsonSchemaService $jsonSchema, ) {} #[Get(path: '/resource/ctx/json-schema', name: 'resources.ctx.json-schema')] public function __invoke(ServerRequestInterface $request): ReadResourceResult { $this->logger->info('Getting JSON schema'); return new ReadResourceResult([ new TextResourceContents( uri: 'ctx://json-schema', mimeType: 'application/json', text: \json_encode($this->jsonSchema->getSimplifiedSchema()), ), ]); } }

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