Skip to main content
Glama

Unleash MCP (Feature Toggle)

get-flag.ts1.52 kB
/** * Get flag details tool for Unleash MCP Server */ import { z } from 'zod'; import { getFeatureFlag } from '../unleash/get-feature-flag.js'; /** * Schema for getFlag tool parameters */ export const GetFlagParamsSchema = { flagName: z.string() }; /** * Handler for getting detailed information about a feature flag */ export async function handleGetFlag({ flagName }: { flagName: string }) { try { // Get the feature flag const flag = await getFeatureFlag(flagName); if (!flag) { return { content: [{ type: "text", text: JSON.stringify({ success: false, flagName, error: `Feature flag '${flagName}' not found` }, null, 2) }], isError: true }; } const summary = `The ${flagName} flag is currently ${flag.enabled ? 'enabled' : 'disabled'}.`; return { content: [{ type: "text", text: JSON.stringify({ flag, summary }, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: JSON.stringify({ success: false, flagName, error: error.message }, null, 2) }], isError: true }; } } /** * Tool definition for getFlag */ export const getFlagTool = { name: "getFlag", description: "Get detailed information about a feature flag", paramsSchema: GetFlagParamsSchema, handler: handleGetFlag };

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