Skip to main content
Glama
aws-powertools

Powertools MCP Search Server

schemas.ts1.39 kB
import { z } from 'zod'; import { ALLOWED_DOMAIN, runtimes } from '../../constants.ts'; /** * Schema for the input of the tool. * * Used to parse the tool arguments and validate them before calling the tool. * * TypeScript and Python runtimes support semantic versioning (x.y.z) or 'latest' in the URL, * so we validate the URL structure accordingly. */ const schema = { url: z .url() .refine((url) => { const parsedUrl = new URL(url); if (parsedUrl.hostname !== ALLOWED_DOMAIN) { return false; } const pathParts = parsedUrl.pathname.split('/').filter(Boolean); const runtime = pathParts[1]; if (!runtimes.includes(runtime as (typeof runtimes)[number])) { return false; } if ( runtime === 'typescript' || runtime === 'python' || runtime === 'java' ) { const version = pathParts[2]; const isValidSemver = /^\d+\.\d+\.\d+$/.test(version); const isLatest = version === 'latest'; if (isValidSemver === false && isLatest === false) { return false; } } return true; }) .transform((url) => { const parsedUrl = new URL(url); parsedUrl.pathname = parsedUrl.pathname.replace(/\/$/, ''); parsedUrl.pathname = `${parsedUrl.pathname}/index.md`; return parsedUrl; }), }; export { schema };

Latest Blog Posts

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/aws-powertools/powertools-mcp'

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