import type { ValidateResult } from "react-hook-form";
const allowedIdentifierCharactersRegex = /^[_a-z0-9-]*$/;
const leadingAndTrailingAlphanumericCharactersRegex =
/^([a-z0-9](.*[a-z0-9])?)?$/;
export function validateIdentifier(value: string): ValidateResult {
if (value.trim() === "") {
return "Cannot be empty";
}
if (!allowedIdentifierCharactersRegex.test(value)) {
return "Must have only lowercase alphanumeric characters, dashes, and underscores";
}
if (!leadingAndTrailingAlphanumericCharactersRegex.test(value)) {
return "Must start and end with lowercase alphanumeric characters";
}
return true;
}
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/Arize-ai/phoenix'
If you have feedback or need assistance with the MCP directory API, please join our Discord server