Skip to main content
Glama
ZhipingYang

FFS MCP Server

by ZhipingYang

ffs_get_flag_options

Retrieve all available values for a feature flag to identify correct Value IDs required for updating flag statuses in the Feature Flag Service.

Instructions

Get all available options (values) for a Flag. Shows Value IDs needed for updates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flagIdYesComplete FFS Flag ID

Implementation Reference

  • src/index.ts:117-162 (registration)
    Registration of 'ffs_get_flag_options' tool with MCP server. Defines the tool name, description, input schema (flagId as string), and the async handler function that calls getFlagOptions and getFlag from ffs-service.
    server.tool(
      'ffs_get_flag_options',
      'Get all available options (values) for a Flag. Shows Value IDs needed for updates.',
      {
        flagId: z.string().describe('Complete FFS Flag ID'),
      },
      async ({ flagId }) => {
        try {
          const options = await getFlagOptions(flagId);
          const flag = await getFlag(flagId);
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify({
                  success: true,
                  flagId,
                  dataType: flag.dataType,
                  defaultValue: flag.defaultValue,
                  options: options.map((o) => ({
                    valueId: o.valueId,
                    value: o.parsedValue,
                    mcpConditionName: o.mcpConditionName,
                    currentAccountCount: o.accountCount,
                  })),
                  message: `Found ${options.length} options. Use valueId to update account's flag value.`,
                }, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify({
                  success: false,
                  message: error instanceof Error ? error.message : 'Unknown error',
                }, null, 2),
              },
            ],
            isError: true,
          };
        }
      }
    );
  • The handler function for 'ffs_get_flag_options' tool. It calls getFlagOptions() to fetch available options and getFlag() to get flag details, then formats and returns the response with success status, dataType, defaultValue, and options list.
    async ({ flagId }) => {
      try {
        const options = await getFlagOptions(flagId);
        const flag = await getFlag(flagId);
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify({
                success: true,
                flagId,
                dataType: flag.dataType,
                defaultValue: flag.defaultValue,
                options: options.map((o) => ({
                  valueId: o.valueId,
                  value: o.parsedValue,
                  mcpConditionName: o.mcpConditionName,
                  currentAccountCount: o.accountCount,
                })),
                message: `Found ${options.length} options. Use valueId to update account's flag value.`,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify({
                success: false,
                message: error instanceof Error ? error.message : 'Unknown error',
              }, null, 2),
            },
          ],
          isError: true,
        };
      }
    }
  • The getFlagOptions function is the core implementation that fetches flag details and extracts all available options. It iterates through flag rules, finds MCP Auto conditions, parses JSON values, and builds the FlagOption array with valueId, parsedValue, mcpConditionName, and accountCount.
    export async function getFlagOptions(flagId: string): Promise<FlagOption[]> {
      const flag = await getFlag(flagId);
      const options: FlagOption[] = [];
    
      for (const rule of flag.rules) {
        const mcpCondition = rule.conditions.find((c) =>
          c.description?.startsWith(FFS_CONFIG.mcpAutoPrefix)
        );
        const accountCount = mcpCondition?.argument
          ? mcpCondition.argument.split(',').filter(Boolean).length
          : 0;
    
        let parsedValue: unknown = rule.value.value;
        try {
          parsedValue = JSON.parse(rule.value.value);
        } catch {
          // Keep as string if not valid JSON
        }
    
        options.push({
          valueId: rule.value.id,
          value: rule.value.value,
          parsedValue,
          mcpConditionName: `${FFS_CONFIG.mcpAutoPrefix} [${rule.value.id}]`,
          accountCount,
        });
      }
    
      return options;
    }
  • The FlagOption interface defines the return type for getFlagOptions, containing valueId, value, parsedValue, mcpConditionName, and accountCount fields.
    export interface FlagOption {
      valueId: string;
      value: string;
      parsedValue: unknown;
      mcpConditionName: string;
      accountCount: number;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is a read operation ('Get'), but doesn't mention any behavioral traits such as permissions required, rate limits, error handling, or what the output format looks like (e.g., list of values). This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose. It's front-loaded and wastes no words, though it could be slightly more structured by separating usage hints into a second sentence. Overall, it's appropriately concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no annotations, no output schema, and a simple input schema, the description is incomplete. It doesn't explain what the return values look like (e.g., a list of options with IDs and labels), any dependencies, or error cases. For a tool that fetches data, more context on output behavior is needed to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'flagId' documented as 'Complete FFS Flag ID'. The description adds minimal value beyond this by implying the parameter is used to fetch options for a specific flag, but doesn't provide additional context like format examples or constraints. Baseline 3 is appropriate given the high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'all available options (values) for a Flag', making the purpose understandable. However, it doesn't explicitly differentiate this from sibling tools like 'ffs_search_flag' or 'ffs_update_account', which might also involve flags, so it misses full sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'Value IDs needed for updates', which hints at a use case for preparing updates, but doesn't specify when to choose this over other tools like 'ffs_search_flag' or what prerequisites exist. This leaves usage context largely implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/ZhipingYang/ffs-mcp-server'

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