Skip to main content
Glama

Unleash MCP (Feature Toggle)

validate-feature-name.ts1.82 kB
/** * Validate feature name tool for Unleash MCP Server */ import { z } from 'zod'; import { validateFeatureName } from '../unleash/validate-feature-name.js'; /** * Schema for validateFeatureName tool parameters */ export const ValidateFeatureNameParamsSchema = { featureName: z.string().describe('Name of the feature flag to validate') }; /** * Handler for validating a feature flag name */ export async function handleValidateFeatureName({ featureName }: { featureName: string }) { try { // Validate the feature name const result = await validateFeatureName(featureName); if (!result.isValid) { return { content: [{ type: "text", text: JSON.stringify({ success: false, featureName, valid: false, error: result.error }, null, 2) }], isError: false // This is not a tool error, just a validation result }; } return { content: [{ type: "text", text: JSON.stringify({ success: true, featureName, valid: true, message: `Feature name '${featureName}' is valid and available for use` }, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: JSON.stringify({ success: false, featureName, error: error.message || 'An unknown error occurred' }, null, 2) }], isError: true }; } } /** * Tool definition for validateFeatureName */ export const validateFeatureNameTool = { name: "validateFeatureName", description: "Validate if a feature flag name is valid and available for use", paramsSchema: ValidateFeatureNameParamsSchema, handler: handleValidateFeatureName };

Implementation Reference

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/cuongtl1992/unleash-mcp'

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