Skip to main content
Glama
cuongtl1992

Unleash MCP (Feature Toggle)

getFeatureTypes

Retrieve a comprehensive list of feature types, including descriptions and lifetimes, for effective management within the Unleash Feature Toggle system.

Instructions

Get a list of all feature types with their descriptions and lifetimes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the getFeatureTypes tool, which fetches all feature types using getAllFeatureTypes and returns them as JSON or error.
    async function handleGetFeatureTypes() { try { // Get all feature types const featureTypes = await getAllFeatureTypes(); if (!featureTypes) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: "Failed to fetch feature types" }, null, 2) }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify({ success: true, count: featureTypes.length, featureTypes: featureTypes }, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: error.message }, null, 2) }], isError: true }; } }
  • Tool schema/definition exporting the name, description, and handler for getFeatureTypes (no input parameters).
    export const getFeatureTypes = { name: "getFeatureTypes", description: "Get a list of all feature types with their descriptions and lifetimes", handler: handleGetFeatureTypes };
  • src/server.ts:183-187 (registration)
    Registration of the getFeatureTypes tool on the MCP server using server.tool().
    server.tool( getFeatureTypes.name, getFeatureTypes.description, getFeatureTypes.handler as any );
  • Helper function that fetches all feature types from the Unleash API via HTTP GET request.
    export async function getAllFeatureTypes(): Promise<any[] | null> { try { const response = await client.get('/api/admin/feature-types'); return response.data || []; } catch (error) { logger.error('Error fetching feature types:', error); return null; } }

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